A function prototype in c or C++ is a declaration of a function that omits the function body but does specify the function's name, arity, argument types and return type. While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.

An example of function prototype:

int fac(int n);

This prototype specifies that in this program, there is a function named "fac" which takes a single integer argument "n" and returns an integer. In another place, the program a function definition must be provided if one wishes to make use of this function.

0 comments: