C++ typedef struct 和 struct

来源:互联网 发布:淘宝买红木家具可靠吗 编辑:程序博客网 时间:2024/06/02 05:16

struct student

{

    int i;

};

使用

          student stu;

         stu.i=1;

 ②

struct student

{

    int i;

} stu;   (stu为结构体变量)

使用

         stu.i=1;

 

 ③

typedef  struct  student

{

    int i ;

}student2;(student2为结构体别名)

使用

          student2 stu;

          stu.i=1;

或者

          student stu;

          stu.i=1;

 

原创粉丝点击