mixing pointers and arrays (arra - (nf)

rgh at inmet.UUCP rgh at inmet.UUCP
Sat Aug 20 19:49:47 AEST 1983


#R:gatech:-37800:inmet:5000004:000:602
inmet!rgh    Aug 19 08:46:00 1983

    The basic problem with passing arrays as values in C is that in
general you don't know how big the array is.  Consider:

	int a[20];		/* here you know */
	extern int b[];		/* no telling */
	f(c)
	    int c[];		/* can't tell */
	{
	}


    Pascal treats the length of an array as part of its type.  However,
this is everybody's least favorite feature of the language, since it
makes general array-handling subroutines impossible to write.
    The length of a structure is determinable from its declaration, so this
problem doesn't arise for structures.

					Randy Hudson
					{harpo,ima}!inmet!rgh



More information about the Comp.lang.c mailing list