的C结构与指针自 [英] C structure with pointer to self
本文介绍了的C结构与指针自的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它是更多钞票来定义一个指针,它指向型结构的结构?我的意思是:
Is it posible to define a structure with a pointer to that type of structure? What I mean is:
typedef struct {
char* name;
node* parent;
} node;
据我试过或阅读,我不知道如何做到这一点,或者如果它甚至有可能。
As far as I tried or read, I don't know how to do this or if it's even possible.
推荐答案
是的,但你必须命名结构,使你可以参考它。
Yes, but you have to name the structure, so that you can refer to it.
typedef struct node_ {
char* name;
struct node_ * parent;
} node;
名称节点
才成为后结构已经完全定义声明。
The name node
only becomes declared after the structure is fully defined.
这篇关于的C结构与指针自的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文