- To print the size of various data types
Size of int : 4 bytes
#include <iostream>
using namespace std;
int main() {
cout<<"Size of int : "<<sizeof(int)<<" bytes"<<endl;
cout<<"Size of char : "<<sizeof(char)<<" byte"<<endl;
return 0;
}
Size of int : 4 bytes Size of char : 1 byteProgram
Just use :
sizeof(dataType)
Just replace dataType value with the one, you want to know size of
dataTypes like: int, char, bool, float, double, . . . .
Coming Soon !
QuickThe dreams I chased took me on a journey, a journey more rewarding than the goals