Prototyping char parameters in ANSI C

Andrew Koenig ark at alice.UUCP
Fri Apr 28 00:30:03 AEST 1989


In article <3950014 at eecs.nwu.edu>, gore at eecs.nwu.edu (Jacob Gore) writes:
> Is this valid ANSI C (or dpANS or whatever you want to call it):
> 
> 	void f(char);
> 
> 	void f(c)
> 	   char c;
> 	{
> 	}

No.

When you say

	void f(c)
		char c;
	{ /* stuff */ }

that is essentially equivalent to:

	void f(int c_temp)
	{
		char c = c_temp;
		{ /* stuff */ }
	}

Neither is equivalent to

	void f(char c)
	{ /* stuff */ }

See page 60 of `C Traps and Pitfalls.'
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list