结构体的三种定义方法

  1. 单独定义:
    先定义结构体类型,再定义变量
    struct student{
    int age;
    string name;
    };
    struct student s1,s2;

  2. 混合定义
    定义结构体类型时,同时定义结构变量
    struct student{
    int age;
    string name;
    }s1,s2;
    其中,s1,s2是变量

  3. 无类型名定义
    struct {
    int age;
    string name;
    }s1;

另外附上自己无脑问题:

结构体的三种定义方法

拓展

点击连接

相关文章:

  • 2021-10-26
  • 2022-12-23
  • 2021-10-29
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-23
  • 2022-12-23
  • 2021-09-12
  • 2022-02-04
  • 2021-11-05
  • 2021-11-23
  • 2022-12-23
相关资源
相似解决方案