void addToTree(SynTree *newNode){
if(tree==NULL){
tree=newNode;
newNode->next=NULL;
}else{
SynTree *curr=tree;
while(curr->next){
curr=curr->next;
}
curr->next=newNode;
newNode->next=NULL;
}
}
incredibly basic c code that i've used in other places. It gets stuck in an infinite loop at the while statement. when I debug with gdb, it tells me that the 2nd node added to the tree is pointing to itself, thus causing the infinite loop. My question is, how? Maybe i'm too sleep deprived to be working right now, but I can't see what's wrong.