Consider this program: Q. Why it is returning size of var as 4 where var is an integer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Consider this program: Q. Why it is returning size of var as 4 where var is an integer

cout << "char: " << sizeof(char) << endl; cout << "int: " << sizeof(int) << endl; cout << "float: " << sizeof(float) << endl; cout << "double: " << sizeof(double) << endl; int var = 50; cout << "var: " << sizeof(var) << endl; /* Outputs char: 1 int: 4 float: 4 double: 8 var: 4 */

25th Jun 2019, 3:55 PM
Kulvardhan Singh Rathore
Kulvardhan Singh Rathore - avatar
1 Answer
0
How int has size 4 bytes float has the size of 4 bytes int has 2 bytes
25th Jun 2019, 4:20 PM
Kulvardhan Singh Rathore
Kulvardhan Singh Rathore - avatar