当前位置: 代码迷 >> C语言 >> 结构初始化???????
  详细解决方案

结构初始化???????

热度:239   发布时间:2006-02-14 18:03:00.0
结构初始化???????
#include<stdio.h>
#include<string.h>
struct date
{
int year;
int month;
int day;
};
struct addlist
{
char name[8];
char stnm[8];
char email[20];
struct date birthday;
};
void main()
{
struct addlist one={"李明","0454989","liming@163.com","?????????????这里怎么初始化啊"};

printf(" name number email birthday\n");
printf("%s %s %s %d.%d.%d.",one.name,one.stnm,one.email,one.birthday.year,one.birthday.month,one.birthday.day);
}
----------------解决方案--------------------------------------------------------
嵌套结构
struct addlist one={"李明","0454989","liming@163.com",{1980,11,2}};
----------------解决方案--------------------------------------------------------
又知道一点..谢谢月下听松
----------------解决方案--------------------------------------------------------
  相关解决方案