Groovy hepcat Mitchell was jivin' on Wed, 19 May 2004 11:07:08 +0800
in comp.lang.c.
Re: function call in conditional operator?'s a cool scene! Dig it!
Yes, of course! Never thought of stretching the meaning
of a function 'pointer' this far. Things like 5["Hello world"]
(as you know I'm sure) are entertaining too.
I'm a bit stumped here, how does 5("Hello world"); works?
It doesn't. But 5["Hello world"] does. It works like this:
1) "Hello world" is somewhat equivalent to
char somestring[] = {'H', 'e', 'l', 'l', 'o', ' ',
'w', 'o', 'r', 'l', 'd'};
2) In an expression, "Hello world"[5] is therefore somewhat equivalent
to somestring[5].
3) This is equivalent to *(somestring + 5).
4) That is equivalent to *(5 + somestring).
6) And that is equivalent to 5[somestring].
7) So, that is somewhat equivalent to 5["Hello world"].
Understand?
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?