A function declaration is a prototype. A function signature indicates what is the return type and the parameters used that makes up the signature. Consider this:
int foo(int, int); /* Function Declaration */
/* Implementation of foo
** Function signature
*/
int foo(int a, int b){
}
Now, consider this scenario: a programmer is asked what is the function signature for foo
:
- It returns a datatype of
int
- Two parameters are also of datatype of
int
, named a
and b
respectively
The function prototype on the other hand is to clue in the C/C++ compiler, on what to expect and if the signature does not match up with the prototype, the compiler will emit an error, along the context of 'function declaration error' or 'prototype mismatch'.
Hope this helps,
Best regards,
Tom.