+ 5

[SOLVED]Explain How it works?

In a challenge of C language I came across a quiz and found this question about guess the output... but I can't understand how the output is 01 If anyone knows please explain Edit 12 sep 2019: <code link deleted, adding code in description > #include <stdio.h> int main() { int n=printf("0"); printf("%d",n); return 0; }

4th Apr 2019, 2:01 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
2 Answers
+ 4
printf("0"); will print "0" and return the number of characters that were printed (1 character). The return value is stored in n and printed to the screen
4th Apr 2019, 2:14 PM
Anna
Anna - avatar
+ 5
Right answer thanks.. if i change to printf("0000"); it gives output 00004 Thanks again Anna
4th Apr 2019, 2:19 PM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar