ProgrammingVery hardGATE CS · Product company OA

What is f in the declaration below?

What is f in the declaration below?
int (*(*f)(int))[3];
  1. A. A function taking an int and returning a pointer to a pointer to an array of 3 ints
  2. B. An array of 3 pointers to functions taking an int and returning int
  3. C. A pointer to a function taking an int and returning a pointer to an array of 3 ints
  4. D. A pointer to a function taking an int and returning an array of 3 pointers to int

Correct answer: C. A pointer to a function taking an int and returning a pointer to an array of 3 ints

Start at f: (*f) makes it a pointer; (int) after it makes that a pointer to a function taking int; the * before that call says the function returns a pointer; [3] then says to an array of 3; int is the element type. Functions cannot return arrays, which rules out the third option outright.

More C Programming questions

Exams that ask this topic