typedef的相关使用
```c
1 #include <stdio.h>
2
3 // 定义一个结构体来模拟类
4 typedef struct Point {
5 int x;
6 int y;
7
8 // 定义函数成员
9 void (*print)(struct Point);
10 void (*move)(struct Point*, int, int);
11 } Point;//
12
13 // 定义函数成员的实现
14 void printPoint(Point p) {
15 printf("Point coordinates: (%d, %d)\n", p.x, p.y);
16 }
17
18 void movePoint(Point* p, int dx, int dy) {
19 p->x += dx;
20 p->y += dy;
21 }
22
23 int main() {
24 // 创建一个Point对象
25 Point myPoint = {3, 5, printPoint, movePoint};
26
27 // 调用函数成员
28 myPoint.move(&myPoint, 2, 3);
29 myPoint.print(myPoint);
30
31 return 0;
32 }
33
~
~
当我typedef struct后面没有跟着一个Point时,会报错。报错如下,为什么?
