array[-1] -- permitted?

Scott Wilson swilson%thetone at Sun.COM
Fri Sep 23 02:15:10 AEST 1988


I'm not quite sure what is being discussed.  I assume the standard
says that the -1'th element on an array is not guaranteed to be
accessible, not that negative array indices are disallowed.  For
example, this is legal is it not:

	int array[10], *ip = array;

	ip++;
	foo(ip[-1]);

I assume when yacc uses array index of -1 it is doing something
similar.


--
Scott Wilson		arpa: swilson at sun.com
Sun Microsystems	uucp: ...!sun!swilson
Mt. View, CA



More information about the Comp.lang.c mailing list