问题
填空题
以下程序的运行结果是______。 struct exmp{char name [10]; int number;}; struct exmp test[3]={{"WangXi",1},{"QiYu",2},{"HuHua",3}}; main() {printf("%c,%s\n",test[0].name[1],test[2].name+3); }
答案
参考答案:a,ua。
解析:
[分析]:test是结构体数组,每个元素均可看作是一个结构体变量,主函数将结构体数组元素test[0]中的name域下标为1的元素以字符形式输出,将结构体数组元素test[2]中的name域从地址name+3开始以字符串的形式输出。