天天看点

c语言结构体注意点

 定义结构体变量的3种方式

  1> 先定义类型,再定义变量(分开定义)

    struct Student

    {

     int age;       

    } ;

    struct Student stu;

    2> 定义类型的同时定义变量

    struct Student

    {

      int age;

    } stu;

    struct Student stu2;

    3> 定义类型的同时定义变量(省略了类型名称)

    struct

    {

     int age;      

    } stu;

继续阅读