69,382
社区成员
发帖
与我相关
我的任务
分享
typedef struct _bag{
int playerId;
int count;
int max;
Prop props[8];
}Bag;
typedef struct _player{
int id;
char name[50];
char pass[50] ;
double gold;
Bag bag; //嵌套上一个结构体
double sysee;
}Player;
Player playerArray[] = {
[0] = {
.id = 1,
.name = "张三",
.pass = "123456",
.gold = 50000,
.bag = {
.max = 8
},
.sysee = 1
},
{2,"李四","123456",15000,{0,0,8},2},
{3,"王五","123456",25000,{.max=8},3},
{4,"星河","123456",50000,0,0,8,}
};
typedef struct _bag{
int playerId;
int count;
int max;
//Prop props[8];
}Bag;
typedef struct _player{
int id;
char name[50];
char pass[50];
double gold;
Bag bag;
double sysee;
}Player;
Player playerArray[] = {
{1, "张三", "123456", 50000, {0, 0, .max = 8}, 0},
{2, "李四", "123456", 15000, {0, 0, .max = 8}, 0},
{3, "王五", "123456", 25000, {0}, 0},
{4, "星河", "123456", 50000, 0, 0}
};
试试这种形式