Interesting C thingy

Ian Molton spyro at f2s.com
Mon Aug 9 09:45:28 PDT 2004


On Mon, 09 Aug 2004 09:14:39 -0700
"Kevin P. Fleming" <kpfleming at linuxfromscratch.org> wrote:

> > What does printf("%c\n",0["unix"]); output and why?
> 
> My guess would be that is prints "u" followed by a newline, but I can't 
> say for sure why I think that :-)

what a nasty bit of code :)

clearly it'll print a character folowed by a newline.

"unix" is a pointer to char

0["unix"]

is equivalent to

"unix"[0] or "unix"+0

so yes, u is correct.



More information about the lfs-chat mailing list