More prototype questions...

David Keppel pardo at june.cs.washington.edu
Fri Oct 21 02:49:40 AEST 1988


I hate to hash this out again, but I have a dpANS-related questions
about the difference between a pointer to an object and the name of
an array of objects.

When I run gcc with all the dpANS flags (-ansi -pedantic), it
complains about functions that are prototyped as

	f (char s[]);

and used as

	static char *x = "honk";
	foo (x);

I think I understand the difference between the array name and a
ponter to objects in the array: the array name is the address of an
object that is the size of the entire array, while a pointer to the
first element of the same array is a pointer to an object the size
of an *element* in the array.

Perhaps I'm answering my own question here, but I don't see why this
distiction causes problems for the prototypes.  Can somebody please
explain?

    ;-D on  ( Thanks again, ladies and gentlemen, for your patients )  Pardo
-- 
		    pardo at cs.washington.edu
    {rutgers,cornell,ucsd,ubc-cs,tektronix}!uw-beaver!june!pardo



More information about the Comp.lang.c mailing list