求助一个C语言结构体数组赋初值的问题

为什么会发生图中的问题呢?该怎么解决?我用的vs2013

typedef struct _test {
    int id;
    char name[20];
    int level;
    int stock;
    double price;
    int d;
} Test;

对结构体赋值,一般是顺序赋值,或者指定赋值

比如

Test test[] = {
    {1, "abc", 1, 2, 1.2, 3},//对应id, name, level, stock, price, d
    {.id = 2, .level=3, price=4.2, .stock=2},//这个就是指定赋值,点后面接的是结构体成员名
};

温馨提示:答案为网友推荐,仅供参考
相似回答