What does the following C-statement declare? int (*f) (int*);
2017
What does the following C-statement declare? int (*f) (int*);
- A.
A function that takes an integer pointer as argument and returns an integer
- B.
A function that takes an integer as argument and returns an integer pointer
- C.
A pointer to a function that takes an integer pointer as argument and returns an integer
- D.
A function that takes an integer pointer as argument and returns a function pointer
Attempted by 366 students.
Show answer & explanation
Correct answer: C
The declaration int (*f)(int*); defines a pointer to a function. The parentheses around *f indicate it is a pointer, not an array or other type. The function takes an integer pointer (int*) as its parameter and returns an int.