C++ Program to Find Size of int, float, double and char in Your System

Find Size of operator

In this Program, you’ll learn how to find size of operator.

Here declares 4 variables of type int, float, double and char. Then, the size of each variable is evaluated using size of operator.

To nicely understand this example to find size of operator, you should have the knowledge of following C++ programming topics:

  1. C++ I/O

To find the size of the variable, size of operators is used.


Program to Find Size of a Variable

#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;


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

Note: You may get a different result if you are using an old computer.

Related Programs

Ask your questions and clarify your/others doubts on C++ Program to Find Size of operators by commenting. Documentation.

Please write to us at [email protected] to report any issue with the above content or for feedback.