How come this output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How come this output?

Recently i have encountered with this program and i have no idea that how it is printing "bye". Somebody please explain this to me https://code.sololearn.com/c6JWI490p8i8/?ref=app

26th May 2020, 5:22 AM
RUSHIKESH S.
RUSHIKESH S. - avatar
4 Answers
+ 2
RUSHIKESH S. I don't know very much how this works under the hood but the reason seems to be that sizeof returns an unsigned int (long int). Try this: if( (int)sizeof (a) > a)
26th May 2020, 5:35 AM
Kevin ★
+ 1
Kevin Star thank you for your help...😊
26th May 2020, 5:39 AM
RUSHIKESH S.
RUSHIKESH S. - avatar
11th Jan 2021, 9:03 AM
Brian
Brian - avatar
0
But sizeof(a) is 4 and a=-1... Then if condition is true... Then hello should be printed...
26th May 2020, 5:32 AM
RUSHIKESH S.
RUSHIKESH S. - avatar