{ int i; if(printf("0")) i=12; else i=13; printf("%d\n",i); return 0; } how the op is 012?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

{ int i; if(printf("0")) i=12; else i=13; printf("%d\n",i); return 0; } how the op is 012??

I have not been able to understand the program.

5th Feb 2020, 12:23 PM
Muskan Mishra
Muskan Mishra - avatar
4 Answers
+ 1
printf function returns no. Charecter outputted.. printf("0") print 0, and the number of charecters outputted is 1, so if block executed... Print 12 So total output is 012
5th Feb 2020, 12:30 PM
Jayakrishna 🇮🇳
5th Feb 2020, 12:31 PM
Muskan Mishra
Muskan Mishra - avatar
+ 1
Well explained by Jayakrishna
5th Feb 2020, 12:32 PM
KnuckleBars
KnuckleBars - avatar
- 1
Please put your code in Code Playground.
5th Feb 2020, 12:28 PM
KnuckleBars
KnuckleBars - avatar