我定义了以下结构:
typedef struct PList{
Person person;
struct PList *nextPerson; // set to NULL by default <<<<<
}PList;
这个方法:
int length(struct PList* db){
PList* cur = db;
int size = 0;
while (cur != NULL){
++size;
cur = cur->nextPerson;
}
return size;
}
error: conflicting types for 'length' is being thrown at the signature for the length method.
有什么想法吗?
最佳答案
这实际上意味着源代码结构中的其他位置有另一个名为 length
的函数/声明,它具有不同的函数签名。
查找 length()
函数的定义位置,并将正确的结构对象传递给该函数(struct PList
类型或 PList*
类型) )
关于c - C 中的链接列表错误 : conflicting types. 解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13609875/