Tagged: understand function prototype

Function Prototype in C Language 7

Function Prototype in C Language

As we all know, before using a variable we need to declare it. Similarly, before using a function we need to declare the function. This declaration of the function is called as function prototyping. Consider the below program. float fnGetAverage(int, int); void main() { int x,y; float z; printf(“\nEnter the values for x and y”); scanf(“%d %d”, &x, &y); z = fnGetAverage(x, y); //function call printf(“\nThe average is %d”, z); } float fnGetAverage(int a, int b) { //function definition float c; c = (a+b)/2; //calculating average return c; //returning the value } There is one statement before the main() function....

FREE C Cheatsheet - Speed Up Your C Programming.

FREE C Cheatsheet - Speed Up Your C Programming.

Download a 7-page free cheat sheet for easy and quick access to C Concepts, Snippets, and Syntax.

Thank you! Check you inbox and access your cheat-sheet