+ 1

What is output of the following C program? Provide explanation please.

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

24th Jul 2022, 5:47 PM
Mehedy Iraq
Mehedy Iraq - avatar
1 Answer
+ 2
Mehedy Iraq if you want to know the output, then run it. It's the most expedient way. In this case you will uncover a syntax error when you run it, due to a missing closing parenthesis. To understand the intended output, know that the return value of the printf function is the number of characters that it printed.
24th Jul 2022, 7:03 PM
Brian
Brian - avatar