设有说明struct DATE{int year;int month; int day;};请写出一条定义语句,该语句定义d为上述结构体变量,并同时为其成员year、month、day 依次赋初值2010、10、1。语句为:①
查看答案
#includestruct st{int x, y;} data[2] = {1,10,2,20};void main(){struct st *p = data;printf("%d,", p->y);printf("%d\n", (++p)->x);}阅读程序,分析程序的运行结果为:
阅读下列程序,分析程序的运行结果。#includestruct STU{char name[9], sex; double score[2];};void main(){struct STU a = {"zhao",’m’,85.0,90.0}, b = {"Qian",’f’,95.0,92.0};b = a;printf("%s,%c,%2.0f,%2.0f\n", b.name, b.sex, b.score[0], b.score[1]);}运行结果为:
阅读下列程序,分析程序的运行结果。#includestruct ord{int x, y;} dt[3] = {1,3,5,7,9,11};void main(){struct ord *p = dt;printf("%d,", ++p->x);printf("%d", ++p->y);}运行结果为:
数组与结构体都是构造类型,它们都可以用于处理多个对象的同一属性。
A. 对
B. 错