一、什么是结构体
结构体:
* 姿势:
struct point{
int x;
int y;
};
=========
二、结构体与数组之间的关系:
数组作为结构体的成员
struct point{
char arr[10];
} xx;
xx.arr
=========
三、结构体与指针之间的关系:
指针作为结构体的成员
struct point{
int *p;
} xx;
xx.p
=========
四、结构体与函数之间的关系:
函数指针作为结构体的成员
void fun(void){}
struct point{
void (*p)(void);
} xx;
xx.p = fun;
xx.p();
=========
五、结构体与结构体之间的关系:
struct qq{
int a;
};
struct point{
struct qq sq;
} xx;
xx.sq.a = 10;
===================================================