Please explain why the output of below code is showing s=4 and x=10?
int x=10, s=0;
3/21/2019 7:14:10 PM
"x = x + 20" is an expression of type int, so it is 4 bytes. sizeof gets replaced by a constant at compile-time, so the code itself is never executed.
Always remember that sizeof operator works on types not on type values
GET THE FREE APP
Learn Playing. Play Learning
Send us a message