mixing pointers and arrays

alan at allegra.UUCP alan at allegra.UUCP
Sat Aug 13 06:20:06 AEST 1983


Someone asked for comments about the idea of being allowed to pass
arrays (real arrays, not pointers) as arguments to functions.

I love it!

I would like to say things like

	main() {
		int array1[10], array2[10];

		array1 = array2;

		f(&array1);	/* Call f with the address of array1. */
		g(array2);	/* Call g with array2. */
	}

Arrays should behave like structures.  After all, an array is just a
structure whose elements are of the same type.  (Or, conversely, a
structure is just an array whose elements are not of the same type.)

Unfortunately, I can't see this ever happening, even though it would
make the language more consistent, more powerful, and more elegant.
Too bad.


	Alan Driscoll
	Bell Labs, Murray Hill



More information about the Comp.lang.c mailing list