To print the numbers forwards instead of backwards, you can recursively transverse the list until you reach the end, and then once you reach the end, print digits and return. All the recursive calls return to where you print the digit, as it percolates up the function frames on the call stack.
Code:
void display_number(PNODE pList)
{
if(pList->next != NULL)
display_number(pList->next);
putchar(pList->digit + '0');
}
I guess, to make the subtraction work, you have several options, depending on any requirements.
Code:
switch(waystodoit)
{
case 1: You can make a method to reverse the linked list
case 2: You can make a method to append to the linked list
You can use elementary style borrow and carry logic on the linked list
Or you can make a method to convert the list to an integer, and use the subtraction operator
}
That was wierd.