C++ Program to find size of Int, Float, Char, and Double


In this program, You will learn how to find size of Int, Float, Char, and Double Data Types in C++.


int Size :4

float Size :4

char Size :1

double Size :8

Size of Data Types in C++


Example: How to find size of Int, Float, Char, and Double Data Types in C++

Run it Now
#include<iostream>
using namespace std;

int main() {

    int a, b, c, d;

    a = sizeof (int);
    b = sizeof (float);
    c = sizeof (char);
    d = sizeof (double);

    cout << "Size of int :" << a << endl;
    cout << "size of float :" << b << endl;
    cout << "size of char :" << c << endl;
    cout << "size of double :" << d << endl;

    return 0;
}

Output:

Size of int :4
size of float :4
size of char :1
size of double :8