ProgrammingVery hard

int inc(int n) { return n + 1; } int dbl(int n) { return n * 2; } int (*f[2])(int) = {inc, dbl}; printf("%d", f[1](f[0](3))); What is printed?

  1. A. 8
  2. B. 7
  3. C. 4
  4. D. 12

Correct answer: A. 8

Calls evaluate inside out: f[0](3) = inc(3) = 4, then f[1](4) = dbl(4) = 8. 7 applies them in the other order (inc(dbl(3))), 4 stops after the inner call, and 12 treats both entries as dbl.

More C Programming questions

Exams that ask this topic