如何解决这个问题,出现too many initializers????????

hantongjing001 2012-05-24 11:19:29
#include "stdio.h"
#include "conio.h"
#include "struct.h"
struct std_info std={"000102","hantongjing",{1992,07,06}};
void main()
{printf("no:%s\n",stud.no);
printf("name:%s\n",std.name);
printf("sex:%s\n",std.sex);
printf("birthday:%d-%d-%d\n",stu.birthday.year,stu.birthday.month,stu.birthday.day);
getch();
}
...全文
3691 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Athenacle_ 2012-05-24
  • 打赏
  • 举报
回复
参数的性别呢?
qq120848369 2012-05-24
  • 打赏
  • 举报
回复
你没觉得你少了一个参数?
hantongjing001 2012-05-24
  • 打赏
  • 举报
回复
试过了 没有用还是出现这个错误
hantongjing001 2012-05-24
  • 打赏
  • 举报
回复
试过了 还是没有用,还是出现这个错误。
fishion 2012-05-24
  • 打赏
  • 举报
回复
应该是类似于这样的吧
typedef struct _DATE
{
int year;
int month;
int day;
}DATE;
struct std_info
{
char no[50];
char name[50];
char sex[10];
DATE birthday;
};
struct std_info stud={"000102","hantongjing","male",{1992,07,06}};
void main()
{
printf("no:%s\n",stud.no);
printf("name:%s\n",stud.name);
printf("sex:%s\n",stud.sex);
printf("birthday:%d-%d-%d\n",stud.birthday.year,stud.birthday.month,stud.birthday.day);
getch();
}
hantongjing001 2012-05-24
  • 打赏
  • 举报
回复
结构体式这个头文件
struct date
{int year;
int month;
int day;
};
struct std_info
{char no[7];
char name[9];
char sex[3];
struct date birthday;
};
struct grade
{char no[7];
int scorel,score2,score3;
struct grade *next;
};
xiaoji0507 2012-05-24
  • 打赏
  • 举报
回复
看看你的结构体怎么定义的。。。
justkk 2012-05-24
  • 打赏
  • 举报
回复
std_info 的定义是怎样的?
itelly 2012-05-24
  • 打赏
  • 举报
回复
struct std_info
{char no[7];
char name[9];
char sex[3];
struct date birthday;
};

少了一个sex

70,038

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧