初学C语言——结构的使用
#include <stdio.h>
#include <string.h>
typedef struct tagdate{
int year;
int month;
int day;
} date;
typedef struct tagstudent{
char name[20];
char sex[4];
int age;
date birthday;
} student;
int main(int argc,const char * argv[]){
// student qq[2]={{"巧巧","女",23,{1999.7.1}},{"泡泡","女",23,{2001,2,2}}};
// printf("name=%s\t",qq[0].birthday.year);
student qq;
strcpy(qq.name,"巧巧");
strcpy(qq.sex,"女");
qq.age=23;
qq.birthday.year=1999;
qq.birthday.month=7;
qq.birthday.day=1;
printf("name=%s\tsex=%s\tage=%d\tyear=%d\tmonth=%d\tday=%d\t",qq.name,qq.sex,qq.age,qq.birthday.year,qq.birthday.month,qq.birthday.day);
return 0;
}