august 发表于 2007-4-24 17:01:01

关于结构


struct date
{
   int month;
   int day;
   int year;
}
struct stud_type
{
   char name;
   int age;
   char sex;
   struct date birthday;
   long num;
   float score;
};
main()
{
   struct stud_type student1={"wang li",18,'m',12,15,1974,89101,89.5};
   struct stud_type student2;
   student2=student1;
   printf("student2:%s,%d,%c,%d/%d/%d,%ld,%      5.2f\n",student2.name,student2.age
      ,student2.sex,student2.birthday.month,student2.birthday.day,
      student2.birthday.year,student2.num,student2.score);
}


为什么这程序运行不了呢?

ultranet 发表于 2007-4-24 17:17:27

struct date
{
int month;
int day;
int year;
}; <---漏了;

august 发表于 2007-4-24 17:22:56

呵呵,无地自容。。。。
页: [1]
查看完整版本: 关于结构