【发布时间】:2022-01-16 05:48:46
【问题描述】:
我有这个结构:
typedef struct {
int id;
node_t * otherNodes;
} node_t;
我的节点中需要一个节点数组......
但在头文件中无法识别:它告诉我`未知类型名称'node_t'
我该如何解决这个问题?
谢谢
【问题讨论】:
-
这能回答你的问题吗? self referential struct definition?
-
我会尝试..但我需要一个其他节点的数组
-
解决方法是给结构本身命名。然后,您可以根据需要转发声明类型别名。或者在声明成员时使用结构名称。
-
你学会了如何使用
struct没有使用typedef吗?因为那可能会阻止这个问题。
标签: c struct declaration typedef undeclared-identifier