结构体类型变量的定义方法
struct Student
{
int num;
char name[20];
char sex;
int age;
float score;
char addr[30];
};
int main( )
{
struct Student student1, student2;
printf("%d\n", sizeof(student1));
return 0;
}
使用了结构体类型的程序
struct Date
{
int year;
int month;
int day;
};
int main()
{
struct Date date;
printf("input year,month,day: ");
scanf("%d %d %d", &date.year, &date.month, &date.day);
int days;
days=……;
printf("%d月%d日是", date.month, date.day);
printf("%d年的第%d天.\n", date.year, days);
return 0;
}