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….