The function declaration or prototype is model or blueprint of the function. If functions are used before they are defined, then function declaration or prototype is necessary. Many programmers prefer a “top-down” approach in which main appears ahead of the programmer defined function definition. Function prototypes are usually written at the beginning of a program, ahead of any user-defined function including main(). Function prototypes provide the following information to the compiler. − The name of the function − The type of the value returned by the function − The number and the type of arguments that must be supplied while calling the function. In “bottom-up” approach where user-defined functions are defined ahead of main() function, there is no need of function prototypes. The general syntax of function prototype is return_type function_name (type1, type2, ...., typen) ; where, return_type specifies the data type of the value returned by the function. A functio...
Learn something about IT