"abcdef"[3] == 3["abcdef"], but why?

Chris Torek chris at mimsy.UUCP
Tue Oct 3 07:53:11 AEST 1989


In article <519.nlhp3 at oracle.nl> bengsig at oracle.nl (Bjorn Engsig) writes:
>Article <19883 at mimsy.UUCP> by chris at mimsy.UUCP (Chris Torek) explains
>how the compiler could/does handle 3["abcde"].  This was very well done,
>except that 3["abcde"] actually evaluates to the char 'd' and not 'c'.

Oh my.  How embarrassing.

>I'm sure that Chris nows that C arrays start with index 0, right Chris :-)

He does now :-)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list