mixing pointers and arrays

Graham Ross grahamr at bronze.UUCP
Tue Aug 16 02:01:05 AEST 1983

What are arrays just like?

In Pascal, arrays are just like records except all the elements are the
same type.  In C, arrays are just like pointers except they reserve stor-
age and they don't work as lvalues.  This is a part of the "pointer rift"
separating Pascal and its relatives from C.

An array cannot be passed at all in C, without putting it in a struct.
When we do:
we are passing a pointer to the 0th element of a (C Ref Man Sec 10.1).
It is not a pointer to the array!  f sees it the same as this:
	p = a; f(p);
It makes no C sense to pass a pointer to the base element of a struct,
since the elements are of varying size.

	Graham Ross

More information about the Comp.lang.c mailing list