结构体定义

# C和C++中typedef的区别

## 在c++中typedef的区别

    (1)
    struct   Student  
    {  
        int a;  
    }stu1;//stu1是一个变量  

    (2)
    typedef   struct   Student2  
    {  
        int a;  
    }stu2;//stu2是一个结构体类型=struct Student  

* 使用时可以直接访问stu1.a;
* 但是stu2则必须先  stu2 s2;
* 然后 s2.a=10;
posted @ 2021-11-30 19:57  芋头hhhh  阅读(55)  评论(0)    收藏  举报