Which declaration represents a function accepting a pointer to a function that takes an int and returns an int?

Options

  • A. int fun(int *)
  • B. int fun(int (*callback)(int))
  • C. int (*fun)(int)
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. int fun(int (*callback)(int))

Detailed Explanation

Correct Answer: Option B

Explanation:
In int fun(int (*callback)(int)), callback is a pointer to a function that accepts an int and returns an int. The function fun itself returns an int. Parentheses around *callback are important because they indicate a function pointer.