【发布时间】:2013-03-20 05:23:02
【问题描述】:
我在 Windows 上使用 MinGW。我正在构建链表,对此我感到困惑。
#include <stdio.h>
#include <stdlib.h>
typedef struct Data
{
int x;
int y;
struct BlaBla * next; /*compiles with no problem*/
}List;
int main(void)
{
List item;
List * head;
head = NULL;
return 0;
}
我现在该结构不能具有结构变量(对象,该结构的实例),但可以具有该结构类型的指针。不知道指针可以是不存在类型的指针。 struct BlaBla * next;(不是链表,必须是struct Data * next,但意思是泛泛之谈)
【问题讨论】:
-
我相信这些被称为“不完整类型”。
-
struct BlaBla 必须在您的程序中的某个地方定义...它编译是因为它将其视为用户定义的类型并且没有进一步定义......但是当您尝试使用它时你的程序它会给你错误,因为它无法找到 struct blabla 的成员。
-
@KinjalPatel 它will compile.