strcpy & declaration of functions

Jitendra Apte apte at helios.cs.duke.edu
Mon Jun 12 22:06:33 AEST 1989


In article <4400001 at tdpvax> scott at tdpvax.UUCP writes:
>
>This is for all you standards nuts out there.  When declaring FUNCTIONS which 
>is better.   
>extern int  atoi();
>extern char *foo();
>or
>int  atoi();
>char *foo();
>They seem to be equivalent and I have found no mention in K&R.

I am not a standards nut, but when baffled by the same question a few months
ago, I picked up K&R1 and sure enough, on pp192-193 we find the following about
declarations :

"At most one sc-specifier may be given in a declaration. If the sc-specifier is
missing from a declaration, it is taken to be `auto' inside a function,
`extern' outside. Exception : functions are never automatic".

PS. `sc-specifiers' are auto, static, extern, register and typedef.

>From the above, I concluded that the two forms of declaring functions are
completely equivalent.

Jitendra.
(Internet) apte at cs.duke.edu; (UUCP) {decvax|ihnp4|allegra}!duke!apte
"Let us save the kid from abortion, so that he can grow up to steal bread,
 rob banks and murder people. Then we can kill him in the electric chair".



More information about the Comp.lang.c mailing list