10[25]==35? Really?

Avery Colter avery at netcom.COM
Mon Feb 25 22:10:56 AEST 1991


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.

But, I guess there must be an exception made here, because it is
effectively a void pointer being indexed, with no way of telling
how many bytes are offset for each number in the brackets?

Very strange stuff indeed.

-- 
Avery Ray Colter    {apple|claris}!netcom!avery  {decwrl|mips|sgi}!btr!elfcat
(415) 839-4567   "I feel love has got to come on and I want it:
                  Something big and lovely!"         - The B-52s, "Channel Z"



More information about the Comp.lang.c mailing list