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