有以下程序 #include <stdio.h> struct st { int x,y;} data[2]={1,10,2,20}; main() { struct st *p=data; printf("%d,",p->y); printf("%d\n",(++p)->x); } 程序的运行结果是______。
A.10,1
B.20,1
C.10,2
D.20,2
第1题:
有以下程序:#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,
第2题:
以下程序的输出结果是( )。 #include<stdio.h> #define F(x)2.84+x #define w(y)printf("%d",(int)(y)) #define P(y)w(y) main() {int x=2; P(F(5)*x); }
A.12
B.13
C.14
D.16
第3题:
以下程序的输出结果是#include "stdio.h"int *fun(int *a,int *b){ int m; m=*a; m+=*b-3; return(&m);}main(){ int x=21,y=35,*a=&x,*b=&y; int *k; k=fun(a,b); printf("%d\n",*k);}
第4题:
以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x<*y) return x; else return y;}main(){ int a=7,b=8, *p,*q,*r ; p=&a; q=&b; r= f(p,q); printf("%d,%d,%d\n",*p,*q,*r);}
第5题:
有以下程序 #include<stdio.h> int fun(int x;int y) { if(x=y)reurn(x); else return((x+y)/2); } main() { int a=4,b=5,c=6; printf("%d\n",fun(2*a,fun(b,c))); } 程序运行后的输出结果是______。
A.3
B.6
C.8
D.12
第6题:
有以下程序 #include<stdio.h> void fun(int*a,int*B) { int*c; c=a;a=b;b=c; } main() { int x=3, y=5,*p=&x, *q=&y; fun(p,q); printf("%d,%d,",*p,*q); fun(&x,&y); printf(" %d,%d\n",*p,*q); } 程序运行后的输出结果是______。
A.3,5,5,3
B.3,5,3,5
C.5,3,3,5
D.5,3,5,3
第7题:
有以下程序: #include<stdio.h> float fun(int x,int y) { return(x+y); } main() { int a=2,b=5,c=8; printf("%3.0f\n",fun((int)fun(a+c,b),a-c)); } 程序运行后的输出结果是( )。
A.编译出错
B.9
C.21
D.9
第8题:
有以下程序: #include <stdio.h> fun(int a, int b) { if(a>b) return(a); else return(b); } main() { int x=3,y=8,z=6,r; r=fun(fun(x,y),2*z); printf("%d\n",r); } 程序运行后的输出结果是( )。
A.3
B.6
C.8
D.12
第9题:
有以下程序
#include <stdio.h>
struct st
{ int x,y;} data[2]={1,10,2,20};
main()
{ struct st *p=data;
printf("%d,",p->y); printf("%d\n",(++p)->x);
}
程序的运行结果是
A)10,1
B)20,1
C)10,2
D)20,2