C |字符串|问题11

预测以下程序的输出:

null

#include <stdio.h>
int main()
{
char str[] = "%d %c" , arr[] = "GeeksQuiz" ;
printf (str, 0[arr], 2[arr + 3]);
return 0;
}


(A) GQ (B) 71 81 (C) 71问 (D) 编译时错误 答复: (C) 说明:

The statement printf(str, 0[arr], 2[arr + 3]); boils down to:
printf("%d %c, 0["GeeksQUiz"], 2["GeeksQUiz" + 3]);
Which is further interpreted as:
printf("%d %c, *(0 + "GeeksQUiz"), *(2 + "GeeksQUiz" + 3));
Which prints the ascii value of 'G' and character 'Q'.

这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享