根据下列的定义,能打印出字母P的语句是( ) struct stu {char name[10]; int age; }; stmct stu s[10]={"John",11, "Paul",12, "Mary"

admin2010-09-05  19

问题 根据下列的定义,能打印出字母P的语句是(    )
   struct stu {char name[10];
   int age;
   };
   stmct stu s[10]={"John",11,
   "Paul",12,
   "Mary",11,
   "adam",12
   }:  

选项 A、printf("%c",s[3].name);
B、printf("%c",s[3].name[1]);
C、printf("%c",s[2].name[11]);
D、printf("%c",s[1].name[0]);

答案D

解析 本题主要考查按结构数组元素方式引用结构成员。字母P为“Paul”的第一个字母,是结构体s[1]的name成员的第二个元素的值,即s [1].name[0]的值。
转载请注明原文地址:https://kaotiyun.com/show/4eWp777K
0

随机试题
最新回复(0)