All mock tests are FREE till 31 December — register to save your progress

Which of the following is the correct way to declare a function pointer in C?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: B. int (*func) (int, int);

Explanation

int (*func)(int, int); declares func as a pointer to a function taking two ints and returning int. Option A declares a function returning int*.

More Programming Languages and Computer Graphics questions