| 
 
| typedef的作用就是给数据类型起别名。 
 1.给基本数据类型起别名:
 typedef int MyInt;
 typedef MyInt MyInt2;
 
 2.给指针类型起别名:
 typedef char *string;
 string name = "Jack";
 
 3.给结构体起别名:
 typedef struct student
 {
 int age;
 }MyStu;
 
 typedef struct
 {
 int age;
 }MyStu;
 
 4.给枚举起别名:
 typedef enum{Man,Woman}Gender;
 
 5.给函数指针起别名:
 typedef int (*MyPoint)(int,int);
 
 6.给结构体指针改名:
 typedef struct Person
 {
 int age;
 }* PersonPoint;
 
 7.typedef和宏定义的区别:
 typedef char* string1;  // 表示给 char* 起名为 string1
 #define string2 char*;  // 表示把 char* 替换成 string2
 
 相同点,都可以这么使用:
 string1 s = "abc";
 string2 ss = "ABC";
 
 区别是:typedef是把类型给换名了,而宏定义只是纯粹的字符串替换。
 比如:
 string1 s1, s2;  因为string1是一个类型,所以相当于  string1 s1;   string1 s2; 也就是 char *s1; char *s2; 两个都是指针。
 string2 s3, s4;  则相当于   char *s3, s4;   也就相当于  char *s3; char s4;   所以s4并不是一个指针变量,而是一个char变量。
 
 | 
 |