Q) What is the output for this code and how ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Q) What is the output for this code and how ?

#include<stdio.h> void main() { int n=printf("0"); printf("%d",n); }

31st Aug 2020, 1:17 PM
Sourabh Duklan
Sourabh Duklan - avatar
1 Answer
+ 11
Initially printf prints 0 , the return value on successful execution of printf returns number of characters in the printf("0") since here only 1 character is there in printf() so it's 1
31st Aug 2020, 1:27 PM
chaithra Gowda
chaithra Gowda - avatar