Ok I am trying to sort a linked list and I have declared
and usedCode:private: struct SongNode { Song s; //value in this node SongNode *next; //cursor points to where the node is //positioned }; SongNode *head; //points to the begining static const int MAX_MEMORY = 256; //most memory allowed
now in this lineCode:void BobCatPod::sort( ) { SongNode *i; SongNode *i_n; SongNode *j; SongNode *temp; if (head == NULL) { return; } j = head; while (j -> next != NULL) { j = j-> next; } while (j!= head) { i = i_n =head; while (i_n != j) { if (i_n-> next-> s < i_n-> s ) { temp=i_n-> next; i_n-> next = temp-> next; temp-> next =i_n; if (i_n-> next = temp); else { next = temp; } } i = i_n; i_n= i_n->next; } j=i; } }I get an error that says next is undeclared. Why???Code:else { next = temp; }



LinkBack URL
About LinkBacks


