C++ Program to Find Size of Int Float Double and Char Data types

By | 23.12.2016

Size of Int Float Double and Char data types


Write a C++ Program to Find Size of Int Float Double and Char data types. Here’s simple Program to Find Size of Int Float Double and Char data types in C++ Programming Language.


To find the size of variable,  sizeof operator is used i.e sizeof(dataType).

Here is source code of the C++ Program to Find Size of Int Float Double and Char data types. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.


SOURCE CODE : :


/*  C++ Program to Find Size of Int Float Double and Char data types  */

#include <iostream>
using namespace std;

int main()
{
    cout << "Size of char: " << sizeof(char) << " byte" << endl;
    cout << "\nSize of int: " << sizeof(int) << " bytes" << endl;
    cout << "\nSize of float: " << sizeof(float) << " bytes" << endl;
    cout << "\nSize of double: " << sizeof(double) << " bytes" << endl;

    return 0;
}

Output : :


/*  C++ Program to Find Size of Int Float Double and Char data types  */

Size of char: 1 byte

Size of int: 4 bytes

Size of float: 4 bytes

Size of double: 8 bytes

Process returned 0

Above is the source code for C++ Program to Find Size of Int Float Double and Char data types which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in the short interval.


Thanks for reading the post….

4.1 12 votes
Article Rating
Category: Basic Programs C++ Programming Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments