Check out example codes for "length of int c++". It will help you in understanding the concepts better.

Code Example 1

unsigned int number_of_digits = 0;

do {
     ++number_of_digits; 
     n /= base;
} while (n);

Code Example 2

sizeof(num);

Learn ReactJs, React Native from akashmittal.com