问题 单项选择题

有以下程序,其输出结果是( )。 #include <iostream> using namespace std; int main(){ char a[10]={'1','2','3','4','5','6','7','8','9',0},*p; int i=8; p=a+i; cout<<p-3<<endl; return 0; }

A.6789

B.6

C.789

D.'6'

答案

参考答案:A

解析: 没有下标的数组名是一个指向该数组首元素的指针,本程序实现的功能是将字符“6”及其以后的字符按字符串形式输出。

选择题
多项选择题