若有以下定义和语句: int a[]={6,7,8,9,10},*p=a; *(p+2)+=2; cout<<*p<<" "<<*(p+2)<<endl; 则下列程序段的输出结果是______。

若有以下定义和语句: int a[]={6,7,8,9,10},*p=a; *(p+2)+=2; cout<<*p<<" "<<*(p+2)<<endl; 则下列程序段的输出结果是______。


参考答案和解析
B 解析:选项B越界,因为该数组元素只有a[0]~a[9]。

相关考题:

设有以下定义和语句,则*(*(p+2)+1)的值为【14】。int a[3][2]={10, 20, 30, 40, 50, 60}, (*p)[2];p=a;

以下程序段的输出结果是______。 int sbr[]={10,8,6,4,2},*p=str+1; printf("%d\n",*(p+2));A.6B.4C.10D.不确定的值

以下程序的输出结果是 ( ) main( ) { int a [10] = {1,2,3,4,5,6,7,8,9,10,},*p=a; printf("%d\n",* (p+2)); }A.3B.4C.1D.2

下面程序的输出结果是main(){ int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a;printf("%d\n",*(p+2));}A.3B.4C.1D.2

若有以下程序段: include using namespace std; int main() {char*p="abcdefgh",*r;l 若有以下程序段:include <iostream>using namespace std;int main(){char*p="abcdefgh",*r;long*q;q=(long*)p;q++;r=(char*)q;cout<<r<<end1;return 0;}该程序的输出结果是【 】。

若有以下程序main(){ int p,a=5;if(p=a!=0)printf("%d\n",p);elsepfintf("%d\n",p+2);}执行后输出结果是【 】。

若有以下变量定义和函数调用语句: int a=25; print_value(a); 则执行下面函数后正确的输出结果是( )。 void print_value(int*x) { cout<<++*x<<endl; }A.23B.24C.25D.26

以下程序的输出结果是【】。includevoid main() {int *p;p=new int;*p=200;cout 以下程序的输出结果是【 】。include<iostream. h>void main() {int *p;p=new int;*p=200;cout<<*p;delete p;}

若有以下定义和语句,则对a数组元素地址的正确引用为 int a[2][3],(*p)[3]; p=a;A.*(p+2)B.p[2]C.p[1]+1D.(p+1)+2

有以下程序:includemain(){int a [10]={1,2,3,4,5,6,7,8,9,10},*p=a[3], *q=p+2; 有以下程序: #include <stdio.h> main() { int a [10]={1,2,3,4,5,6,7,8,9,10},*p=a[3], *q=p+2; prinff("%d\n";*p+*q); } 程序运行后的输出结果是( )。A.16B.10C.8D.6

有以下程序: main() {int a[10]={1,2, 3,4,5,6,7,8,9,10},*p=a[3],*q=p+2; printf("%d\n",*p+*q); } 程序运行后的输出结果是 ______。A.16B.10C.8D.6

执行以下程序段后,m的值为______。 int a[2][3]={ {1,2,3},{4,5,6} }; int m,*p; p=a[0][0]; m=(*p)*(*(p+2))*(*(p+4));A.15B.14C.13D.12

设有以下定义的语句,则*(*(p+2)+1)的值为______。int a[3][2]={10,20,30,40,50,60}, (*p)[2];p=a;A.10B.30C.60D.40

若有以下程序main(){ int p=5,a=5; if(p=1!=0) printf("%d\n",p); else printf("%d\n",p+2);}程序执行后的输出结果是

有以下程序main(){ int a[10]={1,2,3,4,5,6,7,8,9,10},*p=a[3],*q=p+2;printf("%d\n",*p+*q);}程序运行后的输出结果是

有以下程序: main() {int a=[10]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, *p=a[3], *q=p+2; printf("% d\n", *p+*q); } 程序运行后的输出结果是______。A.16B.10C.8D.6

下面程序的输出结果是 ( ) main( ) { int a[10]={l,2,3,4,6,7,8,9,10},*p=a; printf("%d\n",*(p+2));}A.3B.4C.1D.2

若有如下程序:includeusing namespace std;class TestClass{public:void who() {cout 若有如下程序: #include<iostream> using namespace std; class TestClass { public: void who() {cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TcstClass1 obj1; p=obj1; p->who(); return 0; } 则该程序运行后的输出结果是( )。A.TestClass1B.TestClassC.0D.无输出

若有以下程序:includeusing namespace std;class TestClass{public:void who(){cout 若有以下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TestClass1 obj1; P=obj1; P->who(); return 0; 则该程序运行后的输出结果是( )。A.TestClass1B.TestClassC.0D.无输出

若有如下程序: #includeiostream usingnamespaeestd; classTestClass { public: voidwho(){cout"TestClass"endl;} }; classTestClassl:publicTestClass { public: voidwho(){cout"TestClassl"endl;}}; intmain() { TestClass*P; TestClasslobj1; p=&obj1; p-who(); retum0; } 则该程序运行后的输出结果是( )。A.TestClasslB.TestClassC.0D.无输出

若有int a[]={2,4,6,8,10};int *p=a;则第2个数组元素的正确表示为 ______。A.*p++B.p+2C.(p+2)D.*(p+2)

若有下列说明和语句:inta[4][5],(*p)[5];p=a;则对a数组元素的正确引用是()。 A.p+1B.*(p+3)C.*(p+1)+3D.*(*p+2)

以下程序运行后的输出结果是() main()   {int a[10]={l,2,3,4,5,6,7,8,9,10},*p=&n[3], *q=p+2;    printf(”%d\n”,*p+*q);    }

若有说明语句“inta[5],*p=a;”,则对数组元素的正确引用是()。A、a[p]B、p[a]C、*(p+2)D、p+2

有定义:int a[5][4],(*p)[4]=a;,则*(*(p+2)+3)等价于()。A、a[2][0]B、a[2][1]C、a[2][2]D、a[2][3]

单选题设有以下说明和语句:int x[3][4],(* p)[4];p=a;则与表达式*(*p+2)等价的选项是(  )。Aa[0][2]B*(a+2)[0]C(*a+2)[0]Da[2][0]

单选题若有说明语句“inta[5],*p=a;”,则对数组元素的正确引用是()。Aa[p]Bp[a]C*(p+2)Dp+2

填空题以下程序运行后的输出结果是() main()   {int a[10]={l,2,3,4,5,6,7,8,9,10},*p=&n[3], *q=p+2;    printf(”%d\n”,*p+*q);    }