结构体变量的初始化

结构体变量的初始化

形式一

struct student
{
    int num;
    char name[20];
    char sex;
    int age;
    float score;
    char addr[30];
};
struct student stu1={112,"WangLin",'M',19,"200BeijingRoad"};

形式二

struct student
{
    int num;
    char name[20];
    char sex;
    int age;
    float score;
    char addr[30];
}stu1={112,"WangLin",'M',19,"200BeijingRoad"};

形式三

struct
{
    int num;
    char name[20];
    char sex;
    int age;
    float score;
    char addr[30];
}stu1={112,"WangLin",'M',19,"200BeijingRoad"};

你可能感兴趣的:(结构体变量的初始化)