结构体变量的定义
1、先声明结构体类型,再定义变量
struct student
{
int num;
char name[20];
char sex;
int age;
float score;
char addr[30];
}struct student stu1,stu2;
2、在声明类型的同时声明变量
struct student
{
int num;
char name[20];
char sex;
int age;
float score;
char addr[30];
}stu1,stu2;
3、直接定义结构体变量
struct
{
int num;
char name[20];
char sex;
int age;
float score;
char addr[30];
}stu1,stu2;
网友评论