运行下列程序段,输出结果是 ( )struct country{int num;char name[10];} x[5]={1,"China",2,"USA",3,"France",4, "England",5, "Spanish"};struct country *p;p=x+2;printf("%d,%c",p->num,(*p).name[2]);
A. 3,a
B. 4,g
C. 2,U
D. 5,s
查看答案
定义以下结构体数组struct date{int year;int month;int day;};struct s{ struct date birthday; char name[20];} x[4]={{2008, 10, 1, "guangzhou"}, {2009, 12, 25, "Tianjin";语句 printf("%s,%d",x[0].name,x[1].birthday.year); 的输出结果为( )。
A. guangzhou,2009
B. guangzhou,2008
C. Tianjin,2008
D. Tianjin,2009
运行下列程序段,输出结果是( )。struct country{ int num; char name[20];}x[5]={1, "China", 2, "USA", 3, "France", 4, "England", 5, "Spanish"};struct country *p;p=x+2;printf("%d,%s",p->num,x[0].name);
A. 2,France
B. 3,France
C. 4,England
D. 3, China
运行下列程序,输出结果是( )struct contry{int num;char name[20];}x[5]={1,"China",2,"USA",3,"France",4,"Englan",5,"Spanish"};main(){int i;for (i=3;i<5;i++)printf("%d%c",x[i].num,x[i].name[0]);}
A. 3F4E5S
B. 4E5S
C. F4E
D. c2U3F4E
题目:程序通过定义学生结构体变量,存储学生的学号、姓名和3门课的成绩。函数fun的功能是:将形参a所指结构体变量中的数据赋给函数中的结构体变量b,并修改b中 的学号和姓名,最后输出修改后的数据。例如:a所指变量中的学号、姓名和三门课的成绩依次是:10001、"ZhangSan"、95、80、88, 则修改后输出b中的数据应为:10002、"LiSi"、95、80、88。#include #include struct student{long sno;char name[10];float score[3];};void fun(struct student a){struct student b;int i;/***********SPACE***********/b = 【①】;b.sno = 10002;/***********SPACE***********/strcpy(【②】, "LiSi");printf("\nThe data after modified :\n");printf("\nNo: %ld Name: %s\nScores: ",b.sno, b.name);for (i=0; i<3; i++)/***********SPACE***********/printf("%6.2f ", b.【③】);printf("\n");}main(){struct student s={10001,"ZhangSan", 95, 80, 88};int i;printf("\n\nThe original data :\n");printf("\nNo: %ld Name: %s\nScores: ",s.sno, s.name);for (i=0; i<3; i++)printf("%6.2f ", s.score[i]);printf("\n");fun(s);}