Friday, May 09, 2008

Fun with pointers

For the software geeks out there... What is the output from this code? (No cheating - compiling this and running it isn't allowed!)


void Func() {

char *c[] = {
"ENTER",
"NEW",
"POINT",
"FIRST" };

char **cp[] = { c+3, c+2, c+1, c };
char ***cpp = cp;

printf("%s", **++cpp );
printf("%s", *--*++cpp+3);
printf("%s", *cpp[-2]+3);
printf("%s", cpp[-1][-1]+1);
}

No comments: