Out 29
Not yet
nered
Marked out of
100
Predict output for the following code.
#include
#include
int main() {
int a[5)-(1,2,3);
printf("%d", a[4]);
Flag question
return 0;
}
Select one:
a. 3
b. 0
О с. Error
O d.
Answers
Answer:
What is, in your opinion, the most surprising, weird, strange or really "WTF" language feature you have encountered?
Please only one feature per answer.
(5) @gablin I think if you combined LISP delimiters with PERL regex using javascript parsing you would cover 90% of the WTF... - Talvi Watia
[+1859] [2010-01-03 14:41:28] Edan Maor
In C, arrays can be indexed like so:
a[10]
which is very common.
However, the lesser known form (which really does work!) is:
10[a]
which means the same as the above.
(758) that's because a[10] means *(a+10) ... and 10[a] means *(10+a) :) - Michel Gokan
(77) Don't forget "Hello World"[i]. Or i["Hello World"] - Richard Pennington
(167) Or, more usefully, "0123456789abcdef"[x & 0xf] - Dipstick
(8) For an in depth look at this: stackoverflow.com/questions/381542/… - Dinah