10[25]==35? Really?

William G. Hutchison wgh at ubbpc.UUCP
Wed Feb 27 03:21:45 AEST 1991


In article <25694 at netcom.COM>, avery at netcom.COM (Avery Colter) writes:
> With all this about the #define X1 -10, I find it interesting that
> indexing a constant yields the sum of the constant and the number inside
> the brackets.
> 
> I could RTFM till the cows come home and never would have gleaned this.
> 
> Silly me, I would have thought that 10[25] would yield the value
> residing in the position 25 positions away from address 10.
> 
# cat ca.c
main() {
        printf("%d\n", 10[25]);
        return 0;
}
# make ca
        cc -O  ca.c -o ca
"ca.c", line 2: illegal indirection
*** Error code 1

Stop.

 I don't see how RTFMing can show you something that is not true???
-- 
Bill Hutchison, DP Consultant	psuvax1!burdvax!ubbpc!wgh (work)
Unisys UNIX Portation Center	uunet!eidolon!wgh (home)
P.O. Box 500, M.S. B121         "At the moment I feel more like arguing than
Blue Bell, PA 19424		being good" Raymond Smullyan _The Tao is Silent_



More information about the Comp.lang.c mailing list