retagged by
28,315 views
59 59 votes

What does the following C-statement declare?

int (*f) (int * );
  1. A function that takes an integer pointer as argument and returns an integer

  2. A function that takes an integer as argument and returns an integer pointer

  3. A pointer to a function that takes an integer pointer as argument and returns an integer

  4. A function that takes an integer pointer as argument and returns a function pointer

8 Answers

Best answer
81 81 votes
  1. A function that takes an integer pointer as argument and returns an integer $\Rightarrow int \ f (int *)$

  2. A function that takes an integer as argument and returns an integer pointer $\Rightarrow int * f (int )$

  3. A pointer to a function that takes an integer pointer as argument and returns an integer $\Rightarrow$

    int (*f) (int * );

So, answer is C.

edited by
1 1 vote

Small Trick For How to Read 

  • Start at the variable name.

  • Go right (but respect parentheses).

  • If you can’t go right, go left.

  • Keep spiraling out until you’ve read the whole declaration.

Answer:
Position:
Show:

Related questions

9 9 votes
5 answers 5 answers
8.9k
8.9k views
go_editor asked Sep 28, 2014
8,861 views
In the context of modular software design, which one of the following combinations is desirable?High cohesion and high couplingHigh cohesion and low couplingLow cohesion ...
32 32 votes
3 answers 3 answers
15.2k
15.2k views
gatecse asked Sep 21, 2014
15,237 views
Let $f(x)$ be the continuous probability density function of a random variable $x$, the probability that $a < x \leq b$, is :$f(b-a)$$f(b) - f(a)$$\int\limits_a^b f(x) dx...
81 81 votes
10 answers 10 answers
27.8k
27.8k views
Kathleen asked Sep 22, 2014
27,775 views
Consider the following C program:double foo (double); /* Line 1 */ int main() { double da, db; //input da db = foo(da); } double foo (double a) { return a; }The above cod...
35 35 votes
5 answers 5 answers
20.1k
20.1k views
Kathleen asked Sep 18, 2014
20,110 views
Consider the following functionvoid swap(int a, int b) { int temp; temp = a; a = b; b = temp; }In order to exchange the values of two variables $x$ and $y$.call $swap(x, ...