问题
i have the following struct defined:
typedef struct PList{
Person person;
struct PList *nextPerson; // set to NULL by default <<<<<
}PList;
and this method:
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.
Any ideas?
回答1:
That actually means that there is another function/declaration called length
elsewhere in your source code structure that has a different function signature.
Find where length()
function is defined, and pass correct structure objects to that function(either of type struct PList
or PList*
)
来源:https://stackoverflow.com/questions/13609875/linked-lists-in-c-error-conflicting-types-solution