Syntax of function prototypes...

Larry Miller lmiller at venera.isi.edu
Fri Aug 19 02:33:24 AEST 1988


In article <8808171403.AA05181 at ucbvax.Berkeley.EDU> U23405 at UICVM writes:
>Does anyone know (or know where to find) information about the syntax of
>function prototypes? For example, is this correct:?
>
>          int something(int a; float b; char c;);
>          ...
>          int something(int a; float b; char c;)
>          {
>               a += (int) b - (int) c;
>               return a;
>          }
>          ...
>          something(1,2.0,'x');
>
>For example, do the variable names in the function declaration have to agree
>with the variable names in the function definition, etc.?
>

The variable names do not need to agree; in fact, they are not necessary in
the function DECLARATION (prototype).  If names are used, they have scope
only to the end of the declaration.  Any of the following will do,
given the function definition above (except you must use commas, not
semicolons):

definition          int something(int a, float b, char c)

possible prototypes
	  int something(int a, float b, char c);
          int something(int n, float x, char c1);
          int something(int, float, char);

Larry Miller				lmiller at venera.isi.edu (no uucp)
USC/ISI					213-822-1511
4676 Admiralty Way
Marina del Rey, CA. 90292



More information about the Comp.lang.c mailing list