c++ length of int code example
Example 1: length of int c++
sizeof(num);
Example 2: array length c++
// array::size
#include
#include
int main ()
{
std::array myints;
std::cout << "size of myints: " << myints.size() << std::endl;
std::cout << "sizeof(myints): " << sizeof(myints) << std::endl;
return 0;
}
Example 3: c++ length of int
unsigned int number_of_digits = 0;
do {
++number_of_digits;
n /= base;
} while (n);