类型定义 typedef
1、用来建立新的数据名
typedef int Length
;
我们用大写字母作为typedef定义的类型名的首字母,以示区别
2、定义与字符指针同义
typedef char *String
;
3、结构体
typedef struct tnode
*Treeptr
;
typedef struct tnode
{
char *word
;
int count
;
Treeptr left
;
Treeptr right
;
}Treenode
;
上述定义了两个新类型关键字,Treenode(一个结构),Treeptr(一个指向该结构的指针)
4、指向函数的指针
typedef int (*PFI
)(char *,char *);
定义了类型PFI是一个指向函数的指针,该函数有两个char *类型的参数,返回值为int