Just had a glance thru your code and noticed a few things that might be off. The right digit check (right_digit >= 10) you've got is unnecessary because % 10 will always return 0-9 anyway. So you're never going into that branch..

And since you're not going into that branch ... where are you going?

Yup. Had a very fast look , seems like the problem is wrong interpretation of the decade system.

integer ABCDEFG = G*1 + F*10 + E*100 + D*1000 + C*10000 + B*100000 + A*1000000 , 0 <= A, B, C,... <= 9

Here's a fast pseudo ( not so pseudo, its C but not watching after syntax, doing declarations, mallocs etc ) of the sum code, pulled it right off my ass as im typing:

`array1[ASDFG...]`

array2[ZYZ...]

for( i = max ( array1 length - 1 , array2 length - 1 ) ; i >= 0 ) ; i-- ){

excess = 0;

if( i > array1 length-1 ) val1 = 0;

else val1 = array1[i];

if( i > array2 length-1 ) val2 = 0;

else val2 = array2[i];

sum_val = val1+val2+excess;

if( sum_val >= 10 ){

sum_val -= 10;

excess = 1;

}

sum_array[i] = sum_val;

}

Now if there is excess coming out of the block it means the final array has 1 more digit, which can olny be 1, you must realloc the sumarray and prepend the value 1 in position 0 of the sum array. If excess == 0 coming out of the block no modifications are needed. In the former case, you may either malloc 1 extra place initially or realloc it in the end if needed.

Ill leave both those tasks to you!

Hope it helps!

edit:

For substraction, excess is not needed.

For multiplication , excess is the modulus of the multiplication and 10, final array may be MUCH longer than the initials.

`excess = (array1[i]*array2[i])%10`