以下选项中,不能对主函数中变量i和j的值进行交换的程序是
A.
B. include void swap( int *p,int *q){ int *t; *t=*p; *p=*q; *q=*t;}main(){ int i=10,j=20, *a=&i, *b=&j; swap(a,b); printf("i=%d j= %d\n", i,j );}
C. B.
D. include void swap( int *p,int *q){ int t; t=*p; *p=*q; *q=t;}main(){ int i=10,j=20, *a=&i, *b=&j; swap(a,b); printf("i=%d j= %d\n", i,j );}
E. C.
F. include
G. include void swap( int *p,int *q){ int *t; t=(int *)malloc(sizeof(int)); *t=*p; *p=*q; *q=*t; free(t);}main(){ int i=10,j=20; swap(&i,&j); printf("i=%d j= %d\n", i,j );}
H. D.
I. include void swap( int *p,int *q){ int t; t=*p; *p=*q; *q=t;}main(){ int i=10,j=20 , *x=&i, *y=&j; swap(x,y); printf("i=%d j= %d\n", i,j );}
查看答案
有以下程序#include main(){int a[10] = { 1,3,5,7,11,13,17 }, *p=a;printf("%d,", *( p++ ));printf("%d\n", *( ++p ));}程序运行后的输出结果是
A. 1,5
B. 3,5
C. 3,7
D. 1,3
有以下程序#include main(){int *p, x=100;p=&x; x=*p+10;printf("%d\n", x);}程序运行后的输出结果是
A. 110
B. 120
C. 100
D. 90
有以下程序#include void fun( int x, int y, int *z ){ *z = y-x; }main(){int a, b, c;fun(10,5,&a ); fun(7,a,&b ); fun(a,b,&c );printf("%d,%d,%d\n", a,b,c );}程序运行后的输出结果是
A. -5,-12,-7
B. 5,2,3
C. -5,-12,-17
D. 5,-2,-7
有以下程序#include void fun( int *s, int n1, int n2 ){ int i,j,t;i=n1; j=n2;while( i
A. 5 6 7 8 9 0 1 2 3 4
B. 0 9 8 7 6 5 4 3 2 1
C. 4 3 2 1 0 9 8 7 6 5
D. 0 9 8 7 6 5 1 2 3 4