📜  C |字串|问题11

📅  最后修改于: 2021-06-29 00:51:29             🧑  作者: Mango

预测以下程序的输出:

#include 
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'.

这个问题的测验

想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。