You should remember your basic school algorithms for multiplying numbers

123 * 98 =

1107

984

----------------

12054

and you will see that it would work with any count of digits.

So, you have to iterate on the digits of second HugeInt and multiply the first HugeInt operand by any digit number. You best add another operator* which takes a char and simply do

hugesums[i] = hugeop1 * hugeop1.getDigitAt(i);

where i is the current loop counter. Make i 0-based. The getDigitAt would return a char. e. g. '9' and I would count from the right, so that for i=0 you get the least significant digit.

To store the digits in HugeInt, don't use an array. A simple string member will do it.

hugesums in the above sample would be a

vector<HugeInt> hugesums(40, HugeInt(0));

With that the hugesums already is fully allocated and filled with huge integers of 0 value (the internal string is "0").

the operator*(HugeInt huge, char dig)

then would do a multiplication of dig with each digit of the huge operand, add the previous carry and add the remainder of mod10 to the result string. Then, save the new carry.

The total result is a string which could be turned to a HugeInt and be returned by value.

make another helper, which adds zero digits to the right of an HugeInt. You need it to multiply your partial sums by an arbitrary power of 10.

Finally use operator+ to calculate the total sum of the partial sums (hugesum) in aloop and the final result is waht you need as result of operator*.