Quote Originally Posted by wildiv View Post
another problem is that it does not get rid of the 0s, so if we do 1000-999 it equals 0001. so i have to figure out how to get rid of that as well.
You could do something like (untested, but the logic seems right to me)
Code:
int resultsize = result->size;
int leading_zero = 1;
int* tmp;
while(resultsize && leading_zero)
{
	if(result->digits[resultsize] == 0)
		resultsize--;
	else
		leading_zero = 0;
}
if(resultsize != result->size)
{
	tmp = result->digits;
	result->digits = malloc(sizeof(int)*resultsize);
	memcpy(result->digits, tmp, resultsize*sizeof(int));
	result->size = resultsize;
	free(tmp);
}