ProgrammingModerateWipro · Capgemini pattern

What is printed?

What is printed?
printf("%d", printf("hello"));
  1. A. 5
  2. B. hello5
  3. C. hello
  4. D. 5hello

Correct answer: B. hello5

The inner printf must run first to produce the argument: it prints hello and returns the number of characters written, 5. The outer printf then prints 5, giving hello5.

More C Programming questions

Exams that ask this topic