开发者

What would the C code display? [duplicate]

This question already has answers here: Closed 12 years ago.

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜