有以下程序: #include <stdio.h> struct STU { char name[10]; int num; int Score; }; main() { struct STU s[5]={{"YangSan",20041,703},{"LiSiGuo",20042,580}, {"WangYin",20043,680},{"SunDan",20044,550}, {"Penghua",20045,537}}, *p[5],*t; int i,j; for(i=0;i<5;i++) p[i]=&s[i]; for(i=0;i<4;i++) for(j=i+1;j<5;j++) if(p[i]->Score>p[j]->Score) { t=p[i];p[i]=p[j];p[j]=t;} printf("%d%d\n",s[1].Score,p[1]->Score); } 执行后的输出结果是( )。
A.550 550
B.680 680
C.580 550
D.580 680
第1题:
有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU f(STU a) { STU b={"Zhao", 'm', 85.0, 90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex; for (i=0; i<2; i++) a.score[i] = b.score[i]; return a; } main() { STU c={"Qian", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, &sex, &score[O], d.score[1]); } 程序的运行结果是
A.Qian, f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,f,95,92
第2题:
有以下程序: #include <stdio.h> int a=2; int f(int *a) { return (*a) ++;} main() { int s=0; { int a=5; s+=f(&a); } s+=f(&a); printf("%d\n",s) } 执行后的输出结果是( )。
A.10
B.9
C.7
D.8
第3题:
有以下程序 #include <string.h> struct STU { char name[10]; int num; }; void f(char *name, int num) { struct STU s[2]={{"SunDan",20044},{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() { struct STU s[2]={{"YangSan",20041},{"LiSiGuo",20042}},*p; p=&s[1]; f(p->name,p->num); printf("%s %d\n",p->name,p->num); } 程序运行后的输出结果是
A.SunDan 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第4题:
有以下程序:#include <stdio.h>#include <strine.h> struct STU { char name[10]; int hum;};void f(char * name,iht num){ struct STU s[2] = {{ "SunDan" ,20044} , {" Penghua" ,20045}}; num= s[0]. nnm; strepy(name,s[0], name);}main( ){ struct STU s[2] = {{"YangSan" ,20041 }, { "LiSiGao" ,20042}}, * P; p = &s[1]; f(p->name,p->hum); printf("% s %d \n" ,p-> name,p->num);}程序运行后的输出结果是( )。
A.SunDan 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第5题:
有以下程序,程序执行后,输出结果是【 】
include<stdio.h>
void fun(int*A)
{ a[0]=a[1];}
main()
{ int a[10]={10,9,8,7,6,5,4,3,2,1,},i;
for(i=2;i>1=0;i-) fun(&a[i]);
for(i=0;i<10;i++) printf("%d,a[i]);
printf("\n");
}
第6题:
有以下程序 #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,3
B.2,3
C.1,4
D.1,2
第7题:
有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。
A.0
B.10
C.20
D.出错
第8题:
有以下程序: #include <string.h> struct STU (char name[10]; int num; }; void f(char *name, int num) {struct STU s[2]={{"SunDan",20044}.{"Penghua",20045}}; num=s[0].num; strcpy(name,s[0].name); } main() {struct STU s[2]={{"YangSall",20041},{"LiSiGao",20042}},*p;p=&s[1]; f(p->name,p->num); printf("%s%d\n",p->name,p->num); } 程序运行后的输出结果是 ______。
A.SunDan 20042
B.SunDan 20044
C.LiSiGuo 20042
D.YangSan 20041
第9题:
有以下程序:
#include <stdlib.h>
struct NODE
{ int num; struct NODE *next; };
main()
{ struct NODE *p,*q,*r;
p=(struct NODE*)malloc(sizeof(struct NODE));
q=(struct NODE*)mallloc(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.10
B.20
C.30
D.40
第10题:
以下程序的输出结果是( )。 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); }