中国大学MOOC: 写出下面程序执行后的运行结果。#include <stdio.h>struct STU {char name[10]; int num;};void f1(struct STU c){struct STU b={"LiSiGuo",2042};c=b;}void f2(struct STU *c){struct STU b={"SunDan",2044};*c=b;}int main( ){struct STU a={"YangSan",2041},b={"WangYin",2043};f1(a); f2(&b) ;printf("%d %d",a.num,b.num); return 0;}
中国大学MOOC: 写出下面程序执行后的运行结果。#include <stdio.h>struct STU {char name[10]; int num;};void f1(struct STU c){struct STU b={"LiSiGuo",2042};c=b;}void f2(struct STU *c){struct STU b={"SunDan",2044};*c=b;}int main( ){struct STU a={"YangSan",2041},b={"WangYin",2043};f1(a); f2(&b) ;printf("%d %d",a.num,b.num); return 0;}
中国大学MOOC: 写出下面程序执行后的运行结果。#include <stdio.h>struct STU {char name[10];int num;int Score;};int 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",s[1].Score,p[1]->Score); return 0;}
中国大学MOOC: 写出下面程序执行后的运行结果。#include <stdio.h>struct STU {char name[10];int num;int Score;};int 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",s[1].Score,p[1]->Score); return 0;}
1