[ale] This is legal C:

Alan Stewart astewart at layton-graphics.com
Thu Feb 12 15:48:57 EST 2004


Bjorn Dittmer-Roche wrote:

>Someone sent me this. It's an interesting oddity. Try it on your
>favorite C compiler!
>
>	bjorn
>
>--------------------------------------------------
>
>/* Find the strangeness! Spotted on kuro5hin... */
>#include <stdio.h>
>
>char *foo[] = {"what", "the", "heck", "is", "this"};
>
>int main(int argc, char **argv)
>{
>  int j=2;
>  printf("Test: %s\n", j[foo]);
>  return 0;
>}
>  
>

Now forget that you every saw it. If someone working for me actually 
coded something like I think I'd fire 'em.

-- 

D. Alan Stewart
Senior Software Developer
Layton Graphics, Inc.
155 Woolco Drive
Marietta, GA 30065
Voice: 770/973-4312
Fax: 800/367-8192
http://www.layton-graphics.com




More information about the Ale mailing list