有以下程序#include lt;stdio.hgt;struct stu{ int num; char name [10];int age;};Void fun(s
程序
已帮助 人
有以下程序
#include <stdio.h>
struct stu
{ int num; char name [10];int age;};
Void fun(struct stu *p)
{ printf("%s\n,p->name);}
main()
{ struct stu x[3]={ {01,”Zhang”,20},{02, ” Wang”,19},{03, ”zhao”,18} };
fun(x+2);
}
程序运行后的输出结果是
A)Zhang
B)Zhao
C)Wang
D)19
-
参考答案:B【答案】B【知识点】结构体数组与函数调用
【解析】函数调用中 “x+2”即为结构体变量x[2]的地址,所以形参变量p指向x[2]的地址,所以打印输出成员name的值“zhao”。
