Need explanation of this code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need explanation of this code.

I want to know how "printf(" %d", a || b");" outputs 1. Thank you. https://code.sololearn.com/cDyWW6abTQPn/?ref=app

29th Nov 2020, 7:01 AM
Kawsar Ahmed
Kawsar Ahmed - avatar
1 Answer
+ 6
Any non-zero number is true and 0 is false...... || is OR operator ... it returns 1 if either of the 2 inputs is true....here 2 and 4 is true as both are non-zero... So 2||4 gives 1.....
29th Nov 2020, 7:06 AM
Alphin K Sajan
Alphin K Sajan - avatar