Something weird in the output of the following program:
#include "stdio.h"
void main(void)
{
int c = 10;
printf("%d\n",c);
printf("%d\n",sizeof(++c));
printf("%d\n",c);
}
The output will be:
10
4
10++c inside sizeof function is ignored.
Why?
The answer goes like this:
The input argument to sizeof function is datatype and not data. So the datatype of ++i will be considered instead of data ++i. So it will not be incremented.
A Collection Of Weird and Interesting C Programs by Balaji
Thursday, July 12, 2007
Interesting C Program -9
Posted by
Balaji V
at
1:51 PM
Labels: INTERESTING C PROGRAMS
Subscribe to:
Post Comments (Atom)







0 comments:
Post a Comment