Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!sm.unisys.com!aero!venera.isi.edu!lmiller From: lmiller@venera.isi.edu (Larry Miller) Newsgroups: comp.lang.c Subject: Re: Syntax of function prototypes... Message-ID: <6105@venera.isi.edu> Date: 18 Aug 88 16:33:24 GMT References: <8808171403.AA05181@ucbvax.Berkeley.EDU> Reply-To: lmiller@venera.isi.edu.UUCP (Larry Miller) Organization: Information Sciences Institute, Univ. of So. California Lines: 34 In article <8808171403.AA05181@ucbvax.Berkeley.EDU> U23405@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@venera.isi.edu (no uucp) USC/ISI 213-822-1511 4676 Admiralty Way Marina del Rey, CA. 90292