A program which adds 2 integers in the range of 0 to 10^100 I wrote this program to help myself learn C. It is the result of a few days of hacking things together until it worked.

This program takes 2 integers as inputs in the range of 0 to 10100 and outputs the sum of the inputs. 

The code used to generate the final result doesn't really feel that elegant so it would be great to see what could have been done better.

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main()
{
    char input[2][100];

    // Reset arrays to 0
    for (int i = 0; i &lt; 100; i++)
    {
        input[0][i] = 0;
        input[1][i] = 0;
    }

    int length[2];

    scanf ("%s%n", &amp;input[0][0], &amp;length[0]);
    scanf (" "); // Catch the newline
    scanf ("%s%n", &amp;input[1][0], &amp;length[1]);



    // Format user input
    for (int i = 0; i &lt; 2; i++)
    {
        // Convert chars to ints
        for (int b = 0; b &lt; length[i]; b++)
        {
            input[i][b] = input[i][b] - '0';
        }
        // Shift input to end of array and fill start with 0
        for (int a = length[i]; a &gt; 0; a--)
        {
            input[i][(99 - length[i]) + a] = input[i][a - 1];
            input[i][a-1] = 0;
        }
    }

    int longest = length[0] &gt; length[1] ? length[0] : length[1];
    char* output = (char*)malloc(sizeof(char) * longest + 1);

    int carry = 0;
    for (int i = 99; i &gt;= (100 - longest); i--)
    {
        int result = input[0][i] + input[1][i] + carry;
        int remainder = result % 10;
        carry = result / 10;
        output[longest - (99 - i)] = remainder;
    }
    output[0] = carry;


    // Don't output a 0 at the start of output
    int output_offset = 0;
    if (output[0] == 0)
        output_offset = 1;


    for (int i = output_offset; i &lt; longest + 1; i++)
        printf("%d",output[i]);

    printf("\n");
    return 0;
}
Here are some things that may help you improve your code.

Break up the code into smaller functions

Right now, everything is done in main. Rather than having everything in one long function, it would be easier to read and maintain if each discrete step were its own function.  Specifically you could divide into input, output and calculation.

Add error checking

If we enter "alpha" and "edward" as integers, the result is 6453621.  That doesn't really make much sense.  Better might be to screen the inputs to make sure they're really decimal digits.  

Think of the user

The user runs the program and sees... nothing.  It might be nice to show a user prompt.  Even better, in my view, would be to allow the user to enter the numbers as command line parameters.

Don't leak memory

There is a malloc but no matching free which means that this leaks memory.  The operating system will reclaim that memory when the program ends, but it's best to get into good habits now before you tackle more complex programs.

Eliminate "magic numbers"

This code is littered with "magic numbers," that is, unnamed constants such as 10, 99, 100, etc.  Generally it's better to avoid that and give such constants meaningful names.  That way, if anything ever needs to be changed, you won't have to go hunting through the code for all instances of "99" and then trying to determine if this particular 99 is related to what you're trying to change or not.

Avoid scanf if you can

There are so many well known problems with scanf that you're usually better off avoiding it.  The usual approach is to read in user input into a string using something like fgets to allow specifying the input buffer size (and therefore avoiding buffer overrun vulnerabilities).