4.8k views

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

edited | 4.8k views
0

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 * );

by Boss (41.9k points)
edited
+1
what will be the declaration for D ?

and for a pointer to a function which takes an integer pointer as argument , and returns an integer pointer.?
+6

1.  declaration for D ("A function that takes an integer pointer as argument and returns a function pointer")
int* f(int *)

2. for a pointer to a function which takes an integer pointer as argument , and returns an integer pointer.
int* (*f) (int *)

+6

1.  declaration for D ("A function that takes an integer pointer as argument and returns a integer pointer")
int* f(int *)

1.  declaration for D ("A function that takes an integer pointer as argument and returns a function pointer")
int ( * f(int *) ) ()

here f returns a pointer pointing to a function which returns int data and takes no input as arguments.

0
#VS can u write a program on it ??

int ( * f(int *) ) ()
+2
+13

I call this "Brahmaastra" technique for solving such question.

0
thanks ashish
0

0
Declaration of  D will be   ( * f(int *) ) () ... am i right ??
0
ashish bhai u r great
+1
quiet interesting "astra"
0
saurabh rai and VS comment are conflicting

i think vs is correct one
Answer is option C... This is the proptotype to declare a pointer to a function
by Active (3.2k points)
Option c.
by Active (3.3k points)

http://www.geeksforgeeks.org/complicated-declarations-in-c/

Good information to go through

by Loyal (10k points)

By clockwise spiral rule, answer is C

by Active (2k points)