###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
###### Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
###### Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

# C++ HugeInt - trouble with size

C++
I am having trouble obtaining the size of a HugeInt object.. (I want to eventually be able to compare to values)

I'm not sure if a convert (via another constructor) is needed or what. Would really appreciate help with this. Thanks

Please see below for for the two constructors..
``````HugeInt::HugeInt( long value )
:size(0)
{

// initialize array to zero
for ( int i = 0; i < digits; i++ )
integer[ i ] = 0;

// place digits of argument into array
for ( int j = digits - 1; value != 0 && j >= 0; j-- )
{
integer[ j ] = value % 10;
value /= 10;
} // end for
//???size = sizeof(value);

} // end HugeInt default/conversion constructor
HugeInt::HugeInt( const string &number )
:size(0)
{
size = sizeof(number);

// initialize array to zero
for ( int i = 0; i < digits; i++ )
integer[ i ] = 0;

// place digits of argument into array
int length = number.size();
//   int size = strlen( &number );

for ( int j = digits - length, k = 0; j < digits; j++, k++ )
if ( isdigit( number[ k ] ) ) //ensure that char is digit
integer[ j ] = number[ k ] - '0';
} // end HugeInt conversion constructor
``````