Code:
#include "stdafx.h"
That's non-standard, and you don't use anything from it. Your program should be able to compile without you including it. Try it.
Code:
unsigned char number1 [256] = {'0'};
unsigned char number2 [256] = {'0'};
unsigned char result [256] = {0};
unsigned char result1 [256] = {0};
When a compound initializer is missing some values, the remaining elements are filled with 0. This is why
Code:
int array[size] = {0};
fills every element in array with zeros. However, this code
Code:
char string[size] = {'0'};
will put '0' in the first element of string, and 0 is every element thereafter. Perhaps this was what you wanted -- it puts "0\0\0\0\0\0..." in the string after all, but I just thought I'd mention it. (If you do want to initialize every element in an array to something other than zero, either put every element in the initializer explicitly, or use something else like memset() or a for loop.)
Code:
//Allows user to input number
printf ("Please enter a number upto 255 digits long:\n");
scanf ("%s", number1);
printf ("Your first number is %\s.\n",number1);
printf ("Please enter another number upto 255 digits long:\n");
scanf ("%s", number2);
printf ("Your second number is %s.",number2);
scanf() is not the best way to read in a string. But I suppose you're not expecting anything other than digits, and you did say "up to 255 digits". Just as long as you know that that code is very fragile.
Code:
//Shifts the digits back so a bunch of 0's are not leading the number.
for (b=255; result[b] != 0; b--){
result[b] = result[b];
}
The red code does nothing. You can leave the body of a for loop empty, so there's no need for it.
The for loop could also "underrun" the beginning of the array if there are no elements set to zero in result[0]..result[255]. Of course, that shouldn't happen, but it would if the string had overrun the end of the array.
Code:
memmove(result1,result+padding,255-b);
You do know what memmove() does, right? . . .
I guess that your for loops before the memmove()s are to determine the length of the strings. You can use strlen() in place of them. They're strings. If your compiler doesn't let you then you must have been passing the wrong argument to strlen(). This
Code:
for (b=255; result[b] != 0; b--){
result[b] = result[b];
}
padding = b+1;
memmove(result1,result+padding,255-b);
should be able to be replaced with
Code:
padding = strlen(result) + 1;
memmove(result1,result+padding,255-b);
Code:
for(y=254; y>=0; y--) {
Why do you start at 254? Should that not be 255?
Code:
sum = 0;
sum += carry;
That's identical to
Code:
sum += number1[y] - '0' + number2[y];
Why don't you subtract '0' from number2[y]?
Did you actually test this program? The not-subtracting-'0' bug would probably cause it to mess up . . .