单选题
适中
#20922
在 C++ 中,( )正确定义一个名为 student 的结构体,其中包含一个 name 字符数组和一个 age 整数?
在 C++ 中,( )正确定义一个名为 student 的结构体,其中包含一个 name 字符数组和一个 age 整数?
答案与解析
正确答案:A
解析
A正确地定义了一个名为student 的结构体,包含一个字符数组name 和一个整数age。
B错误,顺序不正确,struct应该在前。
C错误,使用了string,但缺少#include <string>头文件,且结构体定义不正确。
D错误,char[20] name; 语法不正确,应该是char name[20];