I am trying to use this code but the problem is that it hangs and i cant tell why. Any ideas?
It should be an insertion sort using a linked list. Thanks!
!Thanks
What should be changed? If i comment one of the two conditions in the if statement it does not work and if i comment the whole if then there`s the else part that needs to be adressed.
if(list == NULL || strcmp(list->str, data) > 0) {
/* apperently this !IS! the first element */
/* now data should [be|becomes] the first element */
p->next = list;
list = p; // Note! Otherwise you'll never see an element in your list
return p;
After line 39: p->next = NULL; Note: set all pointers to something valid/NULL, otherwise you will constantly get into trouble