下面程序的执行结果是 #include"iostream.h" void main() { int * p,r; p=new int; *p=20; r=sizeof(*p); cout<<r<<endl; delete p; }A.程序错误B.内存为20地址的大小C.20D.4
下面程序的执行结果是 #include"iostream.h" void main() { int * p,r; p=new int; *p=20; r=sizeof(*p); cout<<r<<endl; delete p; }
A.程序错误
B.内存为20地址的大小
C.20
D.4
相关考题:
有以下程序#include stdio.h#include stdlib.hint fun(int n){ int *p;p=(int*)malloc(sizeof(int));*p=n; return *p;}main(){ int a;a = fun(10); printf("%d\n",a+fun(10));}程序的运行结果是A)0B)10C)20D) 出错
下面程序错误的语句是①include ②void main( 0③{④int * p = new int[1] ;⑤p =9;⑥co 下面程序错误的语句是 ①#include < iostream.h> ②void main( 0 ③{ ④ int * p = new int[1] ; ⑤ p =9; ⑥ cout <<*p <<end1; ⑦ delete [ ] p; ⑧ }A.④B.⑤C.⑥D.⑦
下列程序的输出结果是()。 include VOid p(int *x) {printf("%d",++*x); } void main() 下列程序的输出结果是( )。#include<stdio.h>VOid p(int *x){ printf("%d",++*x);}void main(){ int y=3;p(y);}A.3B.4C.2D.5
下面程序错误的语句是 ① include ② void main( ) ③ { ④ int * p=new int[1] ; ⑤ p 下面程序错误的语句是① #include<iostream.h>② void main( )③ {④ int * p=new int[1] ;⑤ p=9;⑥ cout < < * p < <endl;⑦ delete[ ] p;⑧ }A.④B.⑤C.⑥D.⑦
下面程序运行时输出结果为______。 include include class Rect { public: Rect(int 下面程序运行时输出结果为______。include<iostream.h>includeclass Rect{public:Rect(int l, int w){length=l; width=w;)void Print(){cout<<"Area:"<<length*width<<end1;}void operator delete(void*p){free(p);}private:int length, width;};void main(){Rect *p;p=new Rect(5, 4);p->Print();delete p;}
下面程序的功能是输出数组s中最小元素,请填空。 include void main(){int k, p, s[]= 下面程序的功能是输出数组s中最小元素,请填空。include<iostream.h>void main(){int k, p, s[]={1,-9,7,2,-10,3};k=s[0];for(p=0;p<6;p++)if(s[p]<k) 【 】;cout<<k;}
下面程序的运行结果是【】。 include void main() {char s[]="9876",*p;for(p=s;p 下面程序的运行结果是【 】。include<iostream.h>void main(){char s[]="9876",*p;for(p=s;p<s+2;p++)cout<<p;}
下面程序运行时输出结果为【】。 include include class Rect { public: Rec 下面程序运行时输出结果为【 】。include<iostream.h>include<malloc.h>class Rect{public:Rect(int1,int w)(length=1;width=w;)void Print(){cout<<"Area:"<<length *width<<endl;)void *operator new(size-t size){return malloc(size);}void operator delete(void *p){free(p)private:int length,width;};void main(){Rect*p;p=new Rect(5,4);p->Print();delete p;}
以下程序的输出结果是【】。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;}
下面程序执行的结果是【 】。 include using namespace std; void main(){ int sum=0; i 下面程序执行的结果是【 】。include <iostream>using namespace std;void main(){int sum=0;int array[6]={1,2,3,4,5,6};int *p;p=array[0];for(int i=0;i<6;i++){sum=sum+*p;p++;}cout<<sum;}
下面的程序输出结果是 ______。 #define r 16 #if r==16 void p(int a) { printf("%x",a) ; } #else void p(int a) { printf("%d",a) ; } #endif main() { p(32); }A.32B.20C.编译时错误D.运行时错误
有以下程序includevoid f(int *p,int *q);main(){ int m=1,n=2,*r=m;f(r, n 有以下程序 #include<stdio.h> void f(int *p,int *q); main() { int m=1,n=2,*r=m; f(r, n); printf("%d,%d",m,n); } void f(int*p,int*q) {p=p+1; *q=*q+1;) 程序运行后的输出结果是______。A.1,3B.2,3C.1,4D.1,2
有以下程序 include struct NODE {int num;stmct NODE*next;}; main() { struct NODE 有以下程序#include<stdlib.h>struct NODE{ int num;stmct NODE*next;};main(){ struct NODE*p,*q,*r;p=(struct NODE*)malloc(sizeof(struct NODE));q=(struct NODE*)malloc(sizeof(struct NODE));r=(struct NODE*)malloc(sizeof(struct NODE));p->num=10;q->num=20;r->num=30;p->next=q;q->next=r;printf(“%d\n”,p->num+q->next->num);}程序运行后的输出结果是A.10B.20C.30D.40
下面程序的执行结果是 #include"iostream.h" void main( ) { int *p,r; p=new int; *p = 20; r=sizeof(*p); cout<<r<<endl; delete p; }A.程序错误B.内存为20地址的大小C.20D.4
有以下程序 include struct NODE{ int num; struct NODE *next;}; main( ) 有以下程序#include <stdlib.h>struct NODE{int num;struct NODE *next;};main( ){ struct NODE *p,*q,*r;int sum=0;p=(struct NODE *)malloc(sizeof(struct NODE));q=(struct NODE *)malloc(sizeof(struct NODE));r=(struct NODE *)malloc(sizeof(struct NODE));p->num=1;q->num=2;r->num=3;p->next=q;q->next=r;r->next=NULL;sum+=q->next->num;sum+=p->num;printf(“%d\n”,sum);}执行后的输出结果是A.3B.4C.5D.6
如下程序的执行结果是 include void main( ) { static int a[ ]={ 1,7,3,9,5,11 如下程序的执行结果是 #include<iostream.h> void main( ) { static int a[ ]={ 1,7,3,9,5,11 }; int * p=a; * (p+3)+=4; cout < < * p < <"," < < * (p+3);}A.1,13B.1,16C.3,13D.1,14
下面程序的输出结果是【】。 include int d=1; int fun(int p){ static int d=5; d+=p; 下面程序的输出结果是【 】。include<iostream.h>int d=1;int fun(int p){static int d=5;d+=p;cout<<d<<" ";return d;}void main(){int a:3;cout<<fun(a+fun(D) )<<end1;}
以下定义数组中错误的是下面程序的执行结果是 #include"iostream.h" void main() {int*p,r; p=new int; *p=20; r=sizeof(*p); cout<<r<<endl; delete p; }A.程序错误B.内存为20地址的大小C.20D.4
下面程序的执行结果是( )。 #include”iostream.h” void main() {int*p,r; p=new in; *p=20; r=sizeof(*p); cout<<r<<endl delete p;}A.程序错误B.内存为20地址的大小C.20D.4
下面程序的执行结果是( )。 #include"iostream.h" voidmain() {int*P,r; P=newint: *P=20: r=sizeof(*p); coutrendl; deleteP;}A.程序错误B.内存为20地址的大小C.20D.4
以下程序的结果是 include void main( ) { char * p="abcdefgh",* r; long * 以下程序的结果是 #include<iostream.h> void main( ) { char * p="abcdefgh",* r; long * q; q=(long * )p; q++; r=(char * )q; cout < < r < < end1;}A.defgB.cdefC.ghabD.efgh
下面程序错误的语句是①include ②void main()③{④int * p=new int[1]⑤p=9⑥cout 下面程序错误的语句是①#include<iostream.h>②void main()③{④ int * p=new int[1]⑤ p=9⑥ cout<<* p<<end1;⑦ delete []p;⑧}A.④B.⑤C.⑥D.⑦
单选题有以下程序:#include #include void fun(int **s, int x[2][3]){ **s =*(x[1]+1);}void main(){ int a[2][3]={1,2,3,4,5,6},*p; p = (int *)malloc(sizeof(int)); fun(p,a); printf("%d",*p);}程序的运行结果是( )。A5B2C6D3
单选题有以下程序:#include #include void fun(int*p1,int*p2,int*s){ s=(int*)malloc(sizeof(int)); *s=*p1+*p2; free(s);}main(){ int a=1,b=40,*q=a; fun(a,b,q); printf(%d,*q);}程序运行后的输出结果是( )。A42B0C1D41
单选题有以下程序#include #include void fun(int*p1,int*p2,int*s){ s=(int*)malloc(sizeof(int)); *s=*p1+*p2;}main(){ int a[2]={1,2}, b[2]={10,20},*s=a; fun(a,b,s); printf(%d,*s);}程序运行后的输出结果是( )。A1B10C11D2
单选题有以下程序:#include void f(int *p);main(){ int a[5]={1,2,3,4,5},*r=a; f(r); printf("%d",*r);}void f(int *p){ p=p+3; printf("%d,",*p);}程序运行后的输出结果是( )。A1,4B4,4C3,1D4,1
单选题有以下程序:#include void f(int*p,int*q);main(){ int m=1,n=2,*r=m; f(r,n); printf("%d,%d",m,n);}void f(int*p,int*q){ p=p+1; *q=*q+1;}程序运行后的输出结果是( )。A1,3B2,3C1,4D1,2