下面程序的运行结果是void swap(int *a,int *b){ int *t; t=a;a=b;b=t;}main(){ int x=3,y=5,*p=&x,*q=&y; swap(p,q); printf("%d%d\n",*p,*q);}
第1题:
下列程序的运行结果是( )。 #include<stdio.h> void fun(int*s,int*p) { static int t=3; *p=s[t]; t--; } void main() { int a[]={2,3,4,5},k; int x; for(k=0;k<4;k++) { fun(a,&x); printf("%d,",x); } }
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,
第2题:
有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =&a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。
A.8,2,3,4.,5,6,7,1,
B.5,6,7,8,1,2,3,4,
C.1,2,3,4,5,6,7,8,
D.8,7,6,5,4,3,2,1,
第3题:
以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=&i,*q=&j; swap(p,q);printf("%d %d\n",*p,*q); }
第4题:
下列程序的运行结果是( )。
#include<stdio.h>
voidfun(int*s,int*p)
{ static int t=3;
*p=s[t];
t--;
}
void main()
{ int a[]={2,3,4,5},k;
int x;
for(k=0;k<4;k++)
{ fun(a,&x);
printf("%d,",x);
}
}
A.5,4,3,2
B.2,3,4,5,
C.2,2,2,2,
D.5,5,5,5,
第5题:
下面程序和运行运行结果是【 】。
void swap(int * a,int * b)
{ int * t;
t=a; a=b; b=t;
}
main( )
{ intx=3,y=5,* p=&x,* q=&y;
swap(p,q);
prinff("%d %d\n", *p, *q);}