#include <stdio.h>
#include <stdlib.h>
#include<string.h>
struct Martial
{
int id; //门派ID
char name[50]; //门派名称
int count; //门派人数
int type; //门派阵营1正派2中立3邪派
};
struct Player
{
int id;
char name[50]; //玩家名称
char pass[50]; //玩家登陆密码
char sex; //玩家性别
struct Martial martial; //门派ID
};
int main()
{
struct Player player={1,"老衲用飘柔",123456,'f',{1,"艾欧尼亚",500,3}};
printf("%s\t%s\n",player.name,player.martial.name);
return 0;
}
pass是字符串
struct Player player ={1, "老衲用飘柔", "123456", 'f', {1, "艾欧尼亚", 500, 3}};// {1, "老衲用飘柔", 123456, 'f', {1, "艾欧尼亚", 500, 3}};
理论上你这个编译都不会通过,因为123456是数字,而里面定义的是char数组