Computer Science, asked by mounikachavala579, 9 months ago

Sizeof() operator Maya is interested to learn programming languages. When she is learning, she had a doubt on how to find the size of the variable. In C++, we have the sizeof() operator, which is used to get the size occupied by a variable or value. Now, write a C++ program to declare a variable of character, integer, float, and double type and print their respective sizes. OUTPUT FORMAT: Print the corresponding size of a character, integer, float and double. SAMPLE OUTPUT: 1 4 4 8

Answers

Answered by ShadowAmitendu
0

Answer:

Just write or copy the below code

Explanation:

#include <iostream>

using namespace std;

int main()  

{    

   cout << "Size of char: " << sizeof(char) << " byte" << endl;

   cout << "Size of int: " << sizeof(int) << " bytes" << endl;

   cout << "Size of float: " << sizeof(float) << " bytes" << endl;

   cout << "Size of double: " << sizeof(double) << " bytes" << endl;

   return 0;

}

Similar questions