标签:结构体-c语言
以下是结构体的基本运用:
//定义结构体
struct Person{
int age;
int height;
char *name;
};
//声明定义对象
struct Person p={20,170,"lean"};
struct Person p2={.name="lean",.age=22,.height=165};
//匿名结构体的对象
struct{
int age;
int height;
char *name;
} p4;
//重新声明类型
typedef struct Person MyPerson;
MyPerson p3={20,170,"lean"};
struct Person p={20,170,"lean"};
struct Person *pp=&p;
printf("%d %d",(*pp).age,pp->age);
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:结构体-c语言
原文地址:http://blog.csdn.net/qq285016127/article/details/46763259