指向结构的指针
结构指针类似于普通变量指针。
#include <stdio.h>
struct point
{
int x;
int y;
};
int main(int argc, char const *argv[])
{
struct point p1 = {100, 100};
struct point *p2;
p2 = &p1;
printf("x: %d, y: %d.\n", p1.x, p1.y);
printf("x: %d, y: %d.\n", p2->x, p2->y);
printf("x: %d, y: %d.\n", (*p2).x, (*p2).y);
return 0;
}