预测以下程序的输出:
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