This code gives an output=01. I did not get this. Can anyone pls explain? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

This code gives an output=01. I did not get this. Can anyone pls explain?

https://code.sololearn.com/c3ALfwXmsJQv/?ref=app

15th Feb 2019, 9:09 AM
Sree
Sree - avatar
4 Answers
+ 2
#include <stdio.h> int main() { int n=printf("0"); // It prints 0 on the screen and returns 1 to the variable n printf("%d",n); //It prints 1 to the screen return 0; } // So the final result is 01 And I got the right output even I checked with your program. There is no problem in your code. For more Interesting Articles, visit my blog: https://doalongme.com/
15th Feb 2019, 9:22 AM
Alok Singh Chauhan
Alok Singh Chauhan - avatar
+ 1
Thank u
15th Feb 2019, 9:26 AM
Sree
Sree - avatar
+ 1
printf() returns the amount of characters that were printed
15th Feb 2019, 10:44 AM
Anna
Anna - avatar
+ 1
Thank u
15th Feb 2019, 2:13 PM
Sree
Sree - avatar