ProgrammingHardGATE CS

What is the exact output?

What is the exact output?
#include <stdio.h>
int main(void) {
    int n = printf("%d%d", 12, 345);
    printf("|%d", n);
    return 0;
}
  1. A. 5|12345
  2. B. 12 345|5
  3. C. 12345|7
  4. D. 12345|5

Correct answer: D. 12345|5

printf returns the number of characters it wrote. The first call prints 12345 (5 characters), and the second prints |5.

More C Programming questions

Exams that ask this topic