What would the C code display? [duplicate]
Possible Duplicate:
Reason for the Output
Hi,
Can you please explain me the output of this code开发者_如何转开发 snippet? The answer is "d"
void main()
{
short int a=5;
clrscr();
printf("%d"+1,a);
getch();
}
Thanks.
"%d" + 1
is a pointer to "d"
, so in fact you are executing printf( "d", a );
.
"%d"+1
is "d"
, therefore the output will be "d"
.
Question a part...
Why didn't the writer simply used:
printf("d");
Is it the same?
精彩评论