Answers for "how to find the length of integer in c++"

C++
2

length of number c++

#include<cmath>
    ...
    int size = trunc(log10(num)) + 1
....
Posted by: Guest on December-29-2021
0

how to find size of int in c++

#include <iostream>
using namespace std;

int main(){    
    cout << "Size of char: " << sizeof(char) << " byte" << endl;
    cout << "Size of int: " << sizeof(int) << " bytes" << endl;
    cout << "Size of float: " << sizeof(float) << " bytes" << endl;
    cout << "Size of double: " << sizeof(double) << " bytes" << endl;

    return 0;
}
Posted by: Guest on March-19-2022

Code answers related to "how to find the length of integer in c++"

Browse Popular Code Answers by Language