I am trying to do insertion sort with list (ADT), I wrote the function InsertionSortList in the sort.c file:
while i am compling my programme, the gcc complier said:
Position P1, P2;
for(P1 = L; P1->Next != NULL; P1 = P1->Next) //problem
temp = P1->Element; //problem
for(P2 = P1; (P2->Last != NULL) && (P2->Last->Element < P2->Element); P2 = P2->Last) //problem
P2->Element = P2->Last->Element; //problem
dereferencing pointer to incomplete type
these problems happend at the lines which I indicate in the function
How can I deal with it? Thx a lot!
The sort.c file, may be useful.:)
can you post the headers "fatal.h" and "list.h". I have a feeling that you have just declared the structures but haven't actually defined them.
ie. You told the compiler a structure name but haven't given any body to that name.
yup, this code
is in list.c
/* Place in the interface file */
put it into list.h
could you tell me where shold I put it in list.h?
replace it with the structure body.