Why is it that the output of the variable is 4 yet it is initialized 50 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is it that the output of the variable is 4 yet it is initialized 50

18th Jun 2017, 6:27 AM
Levine Mugeni
Levine Mugeni - avatar
1 Answer
+ 1
I'm guessing you did something like this: int x = 50; std::cout << sizeof(x); It's because int has a size of 4 bytes. Thats what sizeof does, it does not get the value of x.
18th Jun 2017, 8:33 AM
Dennis
Dennis - avatar