【发布时间】:2012-10-02 05:10:31
【问题描述】:
我想声明一个自引用结构如下
typedef struct
{
entry_t *entry;
node_t *next;
}node_t;
而不是下面的链表
struct node
{
entry_t *entry;
struct node *next;
}*head;
这在 C 中有效吗?如果没有,为什么不呢?
【问题讨论】:
-
这在 C 中有效吗? -- 为什么不先试试呢?
-
@liv2hak:显然你可以设法做到这一点(使用不完整的类型和前向声明);看我的回答。
标签: c pointers data-structures linked-list