全部题库 / C语言 / 试题详情
单选题 C语言
2013-08-05

有以下程序:
#include<<stdio.h>
struct stu
{ int num;
char name[10]:
int age;}
void fun(struct stu*p)
{printf("%s\n",(*p).name);}
the main()
{
struct stu students[3]={{9801,"Zhang".20},
{9802,"Wang",19},{9803,"Zhao",1 8}}
fun(students+2);
}
输出的结果是(    )。

A. Zhang
B.Zhao
C.Wang
D.18

参考答案

B

答案解析

 
从实参传递过去的是结构体系数组的第3个元素,所以输出的name为Zhao。

你可能感兴趣的试题