typedef用来建立新的数据类型 , 例如typedef int Length ;
typedef char * String ;
以后就直接可以使用
String p , lineptr[MAXLEN] ;
复杂的例子用typedef创建树节点
typedef struct tnode * Treeptr ;
typedef struct tnode{
char * word ; //文本
int count ; //出现次数
Treeptr left ; //左子树
Treeptr right ; //右子树
} Treenode ;
Treeptr Myptr = (Treeptr) malloc(sizeof(struct tnode)) ;
从任何意义上讲,typedef 并没有创建一个新的类型,只是为已经存在的类型增加一个新的名称