下面第二种定义后,可这样初始化:
Stu={"xxx", 1.0, 1.0};
//定义一个结构体,类型为struct Student
struct Student
{
string name;
double eng;
double ch;
};
//定义了一个结构体,类型为struct Student;且定义了一个结构体实例,名叫Stu
struct Student
{
string name;
double eng;
double ch;
}Stu;
//定义了无名的结构体,且定义了一个结构体实例,名叫Stu
struct
{
string name;
double eng;
double ch;
}Stu;
//重定义结构体,类型为struct Student 或者是Stu
typedef struct Student
{
string name;
double eng;
double ch;
}Stu;
//重定义结构体,类型为Stu
typedef struct
{
string name;
double eng;
double ch;
}Stu;