Need help combining 2 lists into 1 new list. Almost there

I am trying to combine list1 and list2 into newlist but am having a few errors. After these 2 lists combine, their values will be zero

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

LinkedList catList(LinkedList &list1, LinkedList &list2)
{
	ListNode *nodePtr;
	LinkedList newList;
	newList = catList(list1, list2);

	newList = createList();

	*nodePtr -> list1.head;

	while(*nodePtr->data !NULL)
	{
		*nodePtr -> list1.data;
	}

	*nodePtr ->list2.head;

	newList = list1;

	list1.size = 0;
	list2.size = 0;

	list1 =NULL;
	list2 = NULL;

	return newList;
}




Any help would be appreciated, thank you.
try creating list 3 based on the total size of list 1 and 2. then insert list 1 followed by list 2 into list 3
Topic archived. No new replies allowed.