belongs to collection: C++ Language Basic programs with examples
#include<iostream> using namespace std; int main() { char charType; short shortType; int intType; long longType; float floatType; double doubleType; // Sizeof operator is used to evaluate the size of a declared data type cout << "Size of char: " << sizeof(charType) <<" byte" << endl; cout<<"Size of Short: " << sizeof(shortType) <<" bytes" << endl; cout<<"Size of int: " << sizeof(intType) <<" bytes" << endl; cout<<"Size of long: " << sizeof(longType) <<" bytes" << endl; cout<<"Size of float: " << sizeof(floatType) <<" bytes" << endl; cout<<"Size of double: " << sizeof(doubleType) <<" bytes" << endl; return 0;; }
Result:
Size of char: 1 byte
Size of Short: 2 bytes
Size of int: 4 bytes
Size of long: 8 bytes
Size of float: 4 bytes
Size of double: 8 bytes
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Result:
Size of char: 1 byte
Size of Short: 2 bytes
Size of int: 4 bytes
Size of long: 8 bytes
Size of float: 4 bytes
Size of double: 8 bytes
need an explanation for this answer? contact us directly to get an explanation for this answer