#include <stdio.h>

struct stu
{
    int a;
    int b;
};

int main()
{
    struct stu stu1[2] = 
    {
        {
            .a = 1,
            .b = 333,
        },
        {
            .a = 3,
            .b = 21,
        }
    };
    
    printf("%d\n", stu1[0].b);
}

1.结构体数组中对属性的初始化可以用“.feature”的形式来初始化

2.一个结构体元素中属性间用逗号“,”

相关文章:

  • 2021-06-11
  • 2022-12-23
  • 2021-11-23
  • 2021-11-23
  • 2021-11-23
  • 2021-11-23
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2021-10-12
  • 2022-02-14
  • 2021-10-06
  • 2021-11-23
  • 2021-11-23
相关资源
相似解决方案