Transfer character array in linked list to an integer array

I'm having trouble trying to understand a practice question.

The program is suppose to do a arithmetic calculation no matter how long an integer is.

So firstly i do it by allowing user to input a string and i store them in a dynamic memory storage. I then add to the tail in order to reverse the string to do my calculation.

1
2
3
4
5
6
7
8
9
10
11
	string str1, str2;
	
	cout << "Enter the 1st string" << endl;
	cin >> str1;
	
	cout << "Enter the 2nd string" << endl;
	cin >> str2;
	

	addTail(head1, str1);	 
	addTail(head2, str2);


This is how i added my string into the tail of each node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
NodePtr temp = new Node;
temp -> data = str1;
	temp -> next = NULL;
	
if(head == NULL)
	head = temp;
		
else
{
	NodePtr curr = head;
		
        while(curr -> next != NULL)
		curr = curr -> next;
			
		curr -> next = temp;
}


However the question is, how do i even transfer the character array that i stored in the nodes as linkedlist be taken out and transfered as an integer array before doing the arithmetic calculation?
Last edited on
Topic archived. No new replies allowed.