What is the output of this code? int n = printf("0"); printf("%d", n); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the output of this code? int n = printf("0"); printf("%d", n);

Please explain the logic that how the output is '01'

26th Oct 2020, 6:20 AM
Suman Kumar Dey
Suman Kumar Dey - avatar
2 Answers
+ 4
Printf returns the number of characters that are printed. So n is 1.
26th Oct 2020, 6:43 AM
Soheil
Soheil - avatar
0
thanks Soheil
26th Oct 2020, 6:53 AM
Suman Kumar Dey
Suman Kumar Dey - avatar