0
WHAT IS FUNCTION PROTOTYPE
Explain it as you are explaining it to a 7 year boy
2 Respostas
+ 6
What they both failed to mention is the parameter names are optional so:
int maximum(int,int);
int add(int,int);
would be fine. The names are usually included to document what the function is expecting to receive for those arguments.
+ 1
This is the function definition without the body. It is used in #include files so the compiler can make sure you use the correct argument types when calling the function.
Example function prototype:
int maximum(int a, int b) ;
The full function:
int maximum(int a, int b)
{
return (a > b)? a : b;
}
The function body is usually compiled separately either as part of a library or as a different part of your project while the prototype line appear in an #include file (.h file) that every other file thst wishes to use this function must #include.
Hope this is clear.