Frederick Ding said:
Thanks!
I does not mean the prototype, but full function:
Then you don't understand what "function prototype" means. A function
prototype is a function declaration that lists its parameters. A function
definition is also a function declaration. A prototype allows the compiler
to do type checking and argument counting (except, of course, in the case
of variable argument lists). Consider this extremely simplified example of
why function prototypes are important:
int mani(int i)
{
return i / 2;
}
int main(void) /* <--- this is a prototype */
{
return main(1); /* mani(1) was intended. The compiler
* can and must catch this error. */
}
Now consider this:
int mani(int i)
{
return i / 2;
}
int main() /* <--- this is NOT a prototype */
{
return main(1); /* mani(1) was intended. The compiler
* is not required to catch this error.
* gcc certainly didn't when I tried it
* with -W -Wall -ansi -pedantic */
}
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)