c的结构体的声明方式(四种)

 

//第一种声明方式:标准,正规的
struct person{
int age;
float height;
};
//第三种
typedef struct Emp{
int age;
} Employee;
//第四种
typedef struct {
int age;
} Employee;

//第二种声明方式,相当于匿名的结构
一般只用一次
struct {
 int age;
 float height;
 }p2;

结构体的访问有两种方法:一种是直接点person_t.age,另一种是->,person_t->age;

posted on 2015-10-27 20:49  陈鹤  阅读(804)  评论(0编辑  收藏  举报

导航