typedef struct bunny_info{
/* MORE MEMBERS HERE */
struct bunny_info *nextBunny;
}bunny;
bunny *make_bunny(){
bunny *bunnyPtr;
/* SOME CODE HERE */
return bunnyPtr;
}
bunny *makebunny(bunny *bunnyList, short int makeCount){
bunny *newBunny = NULL, *endPtr = bunnyList;
while(makeCount > 0){
if(bunnyList != NULL){
bunny *temp = bunnyList;
while(temp->nextBunny != NULL){
temp = temp->nextBunny;
}
endPtr = temp->nextBunny;
}
*endPtr = make_bunny(); // ERROR IS HERE, INCOMPATIBLE TYPE. COMPILE TIME.
}
}
I don't get why I'm having a compile time error when the contents of the pointer is also a pointer of the same type. I'm getting no errors when I remove the dereferencing operator but that'll lead to a runtime error.
Also, why can't I use:
typedef struct bunny_info{
/* MORE MEMBERS HERE */
bunny *nextBunny;
}bunny;