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

有以下程序:
#include<stdio.h>
struct stu   
{ int num;char name[l0];int age;};
void fun(struct stu*p)
{ printf("%s\n",p->name);}
main(  )   
{ struct stu x[3]={{01,"Zhang",20),{02,"Wang",l9},{03,"Zha0",l8}};
 fun(x+2);   
}
程序运行后的输出结果是(  )。

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

参考答案

B

答案解析

fun(x+2)表示的是结构体数组中的第3个元素即{03,"Zhao",l8),而输出的是name元素,所以答案为B。

你可能感兴趣的试题