Tuesday, July 22, 2008

What is the output of the following C program?

Just thought I would share a little piece of hell with all of you. What does the following program print?


#include 
void main()
{
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\n", cpp[-1][-1]+1);
}


Highlight below this line to see the answer.
Pointerstew

2 comments:

Noël said...

Oh oh! That was what I was going to guess.

Suzanne said...

You could at least explain to us what "pointerstew" is. Do you have to make it in a crockpot?