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


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


int Size:4

float Size:4

char Size:1

double Size:8

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

#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

Xiith is created for educational, experimental, and schooling purpose. Examples on Xiith are made easier to make a better or basic understanding. Tutorials, testimonials, and examples are continuously checked to avoid delusion, but we cannot take complete responsibility of all programs on Xiith. When you are operating this site, you have to agree to read and accept our terms of use, cookie and privacy policy.Copyright © 2020 by Xiith. All Rights Reserved. About us.