这个是 C 语言里面的写法。
首先,typedef 是用来声明一种新的类型:
typedef int id_t;
id_t oid;
这个应该能看懂吧?
接下来,再看:声明一种指针类型
typedef char* STRING;
STRING str = "hello";
然后就好理解了吧?
struct node 是一个自定义类型,这里你可以理解为 int 之类的。
typedef struct node* tree;
就是声明了一种类型 tree,而 tree 实际上就是 node*;
你可以这样用:
struct node* a_tree; // C++ 里面关键字 struct 是可以省略的。
也可以这样用:
tree atree;
这样说你应该能理解了吧?
温馨提示:答案为网友推荐,仅供参考