I dynamically allocate a new list in the recMergeSort function which should run a constructor but when it get to the functions that use it, I get error C2065: 'otherHead' : undeclared identifier. I have tried setting it to NULL and it didn't work. I even copied the default constructor to a set function and I still get the errors.
Code:
template<class Type>
void unorderedLinkedList<Type>::recMergeSort(nodeType<Type>* &head)
{
otherHead = new nodeType<Type>;
if (head !=NULL)
if (head->link != NULL)
{
divideList(head, otherHead);
recMergeSort(head);
recMergeSort(otherHead);
head = mergeList(head, otherHead);
}
}
I'm beginning to wonder if I'm sending the correct data type. Here is the heading of the functions that I'm using from the book. Any suggestions?
Code:
void unorderedLinkedList<Type>::divideList(nodeType<Type>* first1,
nodeType<Type>* first2)