I am trying to write a program using linked lists which takes in numbers the program must input two integers of arbitrary length from the keyboard. The built-in data types in C such as int and long have a maximum fixed length so variables of these types cannot be used to input the integers from the keyboard. Each large integer must be read from the keyboard and stored in a singly linked list, one digit per node. The least significant digit of the large integer must be stored at the top of the list and the most significant digit must be stored at the end of the list. Assume that each large integer has at most 50 digits.
After creating the linked lists for the two large integers, you must find the sum of the integers. This sum must be stored in another linked list.

I have wirtten the part which inputs and reads the numers , allocates the memory,makes the list,and prints what's in the list.I tried writing a reverse but aomehow it's not working.THE troublesome part that i m not sure how to approach is the part where i sum the digits in the link list.I was thinkin along the lines of reversing the original list (list1 and list2) and storing it in new lists (r1 and r2).then i will traverse the new lists adding the first digits(which will be the last).is this a logical approach?im not sure how to do this part please help me.thanks

i hope i explained the problem clear enough!
if i input 11111111111111111111111111 in list1
and i input 22222222222222222222222222 in list2
i should print out 33333333333333333333333333




here is my code:

Code:
#include<stdio.h>
#include<stdlib.h>

typedef struct node{
        int num;
        struct node*next;
        }node,*nodeptr;

void sl();
nodeptr makenode(int);
void print(nodeptr);
nodeptr makelist();
nodeptr reverse1(nodeptr);

int main(){
    nodeptr List1=NULL,List2=NULL,r1=NULL,r2=NULL;
    
    printf("enter numbers for first large interger,type -999 to end data input: ");
    List1=makelist();
    sl();
    printf("enter numbers for second large interger,type -999 to end data input: ");
    List2=makelist();
    
    print(List1);
    sl();
    print(List2);
    sl();
    sl();
   r1 =reverse1(List1);
    print(r1);
     sl();
    
   r2 =reverse1(List2);
   print(r2);
   sl(); 
    
    
    system("pause");
    return 0;
}

nodeptr makenode(int n){
        nodeptr np=(nodeptr)malloc(sizeof(node));
        np->num=n;
        np->next=NULL;
        return np;
        }



void  print(nodeptr np){
        while (np!=NULL){
              printf("%d",np->num);
              np=np->next;
              }
              }
              
              
              
      

nodeptr makelist(){
        nodeptr makenode(int),np,top,last;
        int n;
        top=NULL;
        scanf("%d",&n);
        while(n!=-999){
                       np=makenode(n);
                       if(top==NULL)top=np;
                       else  last->next=np;
                       last=np;
                       scanf("%d",&n);
                       }
                       return top;
                       }
                       
void sl(){
     printf("\n");
     }    //just skips a line.




    nodeptr reverse1(nodeptr top){
            
            nodeptr newtop=NULL,temp=NULL;
            while(top!=NULL){
                             temp=top;
                             top=top->next;
                             temp->next=newtop;
                             newtop=temp;
                             }
                             return newtop;
                             }
[\code]