C function prototypes 🤖

preview_player
Показать описание
C function prototypes tutorial example explained

#C #function #prototype

void hello(char[], int); //function prototype

int main()
{
// function prototype

// WHAT IS IT?
// Function declaration, w/o a body, before main()
// Ensures that calls to a function are made with the correct arguments

// IMPORTANT NOTES
// Many C compilers do not check for parameter matching
// Missing arguments will result in unexpected behavior
// A function prototype causes the compiler to flag an error if arguments are missing

// ADVANTAGES
// 1. Easier to navigate a program w/ main() at the top
// 2. Helps with debugging
// 3. Commonly used in header files

char name[] = "Bro";
int age = 21;

hello(name, age);

return 0;
}

void hello(char name[], int age)
{
printf("\nHello %s", name);
printf("\nYou are %d years old", age);
}
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

void hello(char[], int); //function prototype

int main()
{
// function prototype

// WHAT IS IT?
// Function declaration, w/o a body, before main()
// Ensures that calls to a function are made with the correct arguments

// IMPORTANT NOTES
// Many C compilers do not check for parameter matching
// Missing arguments will result in unexpected behavior
// A function prototype causes the compiler to flag an error if arguments are missing

// ADVANTAGES
// 1. Easier to navigate a program w/ main() at the top
// 2. Helps with debugging
// 3. Commonly used in header files

char name[] = "Bro";
int age = 21;

hello(name, age);

return 0;
}

void hello(char name[], int age)
{
printf("\nHello %s", name);
printf("\nYou are %d years old", age);
}

BroCodez
Автор

I'm not gay, but I love you bro sincerely from the bottom of my heart.

You and Organic Chemistry.

krlo
Автор

Short, precise and to the point, Damn bro

briankepha
Автор

Nice Explanation. I wanna be fellow bro.

siddharthjain
Автор

Please do a video on how to create your own library file that you can #include in your programs

robinpage
Автор

Here's some code I made for practice:

#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

double power(double, double);

int main(){
double result;
double baseNumber;
double addedNumber;
printf("This is the addition calculator program, what is the base number?\n");
scanf("%lf", &baseNumber);
printf("\nWhat would you like to use as the added number?\n");
scanf("%lf", &addedNumber);
result = power(baseNumber, addedNumber);
printf("\nYour result is: %.1lf", result);
}

double power(double base, double additionalNumber){
return base + additionalNumber;
}

PSIwolf
Автор

Hey, how are you able to run the program without first declaring "hello" function before main. Whenever I try to do that, I get a function declaration error. Thanks!

colincazho
Автор

We use C lang in the first year please put more content about C, nd I'll be much appreciate

bilaltoumir
Автор

I like how you speed up the video when you're typing.... right!?!

TheScissorunner
Автор

I need a count++ for every time you say == function

justcallmeq