I'm writing a class that can handle integers up to 40 characters long, I have been able to get add and subtract working fine, but I can't see what is wrong with multiply.

numList is an array of integers (i know, they could be smaller in size), and it just holds the number, index 0 being the least significant number. Using this code, I get small negative numbers (I'm assuming because numList is signed, for when I set it as unsigned, the numbers are extremely large). hugeSize is a #define set at 40. Does anyone see what is wrong with my code? (please no code posting unless it's a small mistake). thank you. (ps, if you need more code, or prototypes, I can upload).

Code:void hugeInt::multiply(hugeInt n, hugeInt m) //multiply two hugeInts { for (int t=0; t<hugeSize; t++) //clear current numList[t]=0; int val=0; for (int i=0; i<hugeSize; i++) //multiply each element in n by { //every element in m for (int j=0; j<hugeSize; j++) { val = n.numList[i] * m.numList[j]; numList[i+j] = val % 10; numList[i+j+1] += val / 10; numList[i+j] += val % 10; } } }