以下代码的输出是 :void f( int *pa, int *pb ) { int pt; pt = *pa, *pa = *pb, *pb = *pa; } int main(void) { int x=1, y=2; f(&x, &y); printf("%d%d", x, y); }
22
举一反三
- 以下代码的输出是 :void swap( int *pa, int *pb ) { int pt; pt = *pa, *pa = *pb, *pb = *pa; } int main(void) { int x=1, y=2; swap(&x, &y); printf("%d%d", x, y); }
- 中国大学MOOC: 以下程序段的输出是( )。void swap(int *pa, int *pb) { int pt; pt = *pa, *pa = *pb, *pb = *pa;}int main(void){ int x=1, y=2; swap(&x, &y); printf(%d %d, x, y);}
- 中国大学MOOC: 以下代码的输出是 :voidswap(int*pa,int*pb){intpt;pt=*pa,*pa=*pb,*pb=*pa;}intmain(void){intx=1,y=2;f(&x,&y);printf("%d%d",x,y);}
- 下列程序运行后的输出结果是:_____#includestdio.hvoid fun( int *pa, int pb ) { int pt; pt = *pa, *pa = pb, pb = pt;}int main( ){ int x=1, y=2; fun(x, y); printf(%d, x==y); return 0;}
- 以下程序运行结果是()。#includeiostreamusing namespace std;void sub(int x, int *y,int *z){*y=*y-10;*y=*z+x;}int main(){int a=10,b=12,* pa,* pb;pa=a;pb=b;sub(b-a,pa pa);coutaendl;return 0;} A: 9 B: 4 C: 7 D: 2
内容
- 0
若有语句:int a,b; int *pa,*pb; pa=&a; pb=&b; 正确的输入语句是() A: scanf("%d%d",x, y); B: scanf("%d%d",pa,pb); C: scanf("%d%d",&pa,&pb); D: scanf("%d%d",*pa,*pb);
- 1
【填空题】以下程序的输出结果是 。 main() {int a=10,b=20,*pa=&a,*pb=&b,*p; p=pa;pa=pb;pb=p; printf(“%d,%d”,*pa,*pb);}
- 2
以下程序输出结果是( ) #include void sub ( double x,double *y ,double *z) {*y =*y -1.0;*z= *z +x;} main () {double a= 2.5, b= 9.0,*pa, *pb; pa= &a; pb =&b; sub ( b-a, pa,pa ); printf ("%f\n", a); } A: 9.000000 B: 1.500000 C: 8.000000 D: 10.500000
- 3
#include [stdio.h] int x,y; int f(int x){ y=x++; printf("%d",y); } int main(void){ int x=5; f(x); f(x); return 0; }
- 4
有以下程序 void f( int y,int *x) {y=y+*x; *x=*x+y;} main( ) { int x=2,y=4; f(y,&x); printf(“%d %d ”,x,y); } 执行后输出的结果是