这是我用于节点的结构...
typedef struct
{
struct Node* next;
struct Node* previous;
void* data;
} Node;
这是我用来链接它们的函数
void linkNodes(Node* first, Node* second)
{
if (first != NULL)
first->next = second;
if (second != NULL)
second->previous = first;
}
现在 visual studio 在这些行上给我智能感知(较少)错误
IntelliSense: a value of type "Node *" cannot be assigned to an entity of type "Node *"
谁能解释一下这样做的正确方法? Visual Studio 会编译并运行它,它在我的 Mac 上也能正常工作,但在我学校的服务器上崩溃了。
编辑:我想过使用 memcpy,但这很简单
最佳答案
我认为问题在于没有名为 Node 的 struct,只有一个 typedef。尝试
typedef struct Node { ....
关于c - 使用 typedef 结构时出现错误 'a value of type "X *"cannot be assigned to an entity of type "X *"',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15595449/