所以我正在尝试实现一个链表,并且每个节点都有这个结构:
typedef struct listNode {
struct listNode *next;
void *data;
} NODE;
以前,我制作了一个游戏,其中航天器结构如下所示:
typedef struct {
int height;
int width;
} SPACECRAFT;
我可以做一个新的宇宙飞船
SPACECRAFT plyrShip = {
.width = //someInt;
.height = //someInt;
};
虽然使用节点,但变量是指针,它不允许我通过这样做来创建新节点
NODE newNode = {
.*next = null;
.*data = *data //function has *data as parameter so I can pass it
//into the node
}
我究竟做错了什么?