结构体
结构体是用户建立由不同类型数据组成的混合型的数据结构(数据类型)。
系统提供的类型:int double float char long 数组,指针......一般形式:
struct 结构体名{
成员;
};
例如:定义一个学生的结构体,学生包括姓名,性别,年龄。声明一个学生的变量,输出学生的信息。...Student stu,stu2;
strcpy(stu.name,"zhangsan");
stu.sex='M';
stu.age=10;
printf("%s %c...%d\n",stu1.name,stu1.sex,stu1.age);
printf("%s %c %d\n",stu2.name,stu2.sex,stu2.age);
printf(...%d\n",a[i].name,a[i].sex,a[i].age);
}
return 0;
}
结构体指针
结构体指针是指向结构体变量的指针,一个结构体变量的地址就是这个结构体变量的指针