C++ Program to find size of int, float, double and char in Your System

#include <iostream>
using namespace std;
int main() {
   cout<<"Size of int is "<<sizeof(int)<<" bytes"<<endl;
   cout<<"Size of float is "<<sizeof(float)<<" bytes"<<endl;
   cout<<"Size of double is "<<sizeof(double)<<" bytes"<<endl;
   cout<<"Size of char is "<<sizeof(char)<<" byte"<<endl;
   return 0;
}

OUTPUT:

Size of int is 4 bytes
Size of float is 4 bytes
Size of double is 8 bytes
Size of char is 1 byte

Leave a Comment