补充:
typedef
作用:定义类型
一般格式:
typedef type newname;
如 typedef int A;
则:A a;相当于:int a;
例子:
typedef struct node{
int num;
char name[10];
struct node *next;
};
typedef struct node NODE; //定义新的类型
typedef node *pNODE; //定义新类型指针
NODE 代表struct node 类型
pNODE 代表struct node 指针类型
可以这样写:
typedef struct node{
int num;
char name[10];
struct node *next;
}NODE, *pNODE;
NODE P;
pNODE q;
q=&p;
q->num=110;