C Programming - Complicated Declarations - Discussion

Discussion Forum : Complicated Declarations - General Questions (Q.No. 6)
6.
Declare the following statement?
"A pointer to a function which receives an int pointer and returns float pointer".
float *(ptr)*int;
float *(*ptr)(int)
float *(*ptr)(int*)
float (*ptr)(int)
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
10 comments Page 1 of 1.

Mdv ajay said:   8 years ago
Good, Thanks @Pradeep.

Kartik said:   9 years ago
Nice trick @Mohini.

Vasanth said:   10 years ago
float *(*ptr)(int*); is implicitly converted into ptr*(int*)float* which means that ptr is pointer to a function, which receives int pointer and returns float pointer.

Navin said:   1 decade ago
@Mohini : What will you do if there is one more option with 3 *s ?

Ranjith said:   1 decade ago
Simple answer i.e. function declared as pointer function which receives integer type pointer as argument and returns float type pointer.

Chandan Singh said:   1 decade ago
(int*)= specifies that it receives an input pointer.
(*ptr)(int*)= it specifies that it is a pointer to function which receives integer pointer.
float *(*ptr)(int*)= this specifies that it returns float pointer.
(2)

Pradeep Rai said:   1 decade ago
Simple answer i.e. function declered as pointer function which recieve intger type pointer as argument and returns float type pointer.

Pardhu said:   1 decade ago
Nice trick you told.

Rams said:   1 decade ago
Superb.

Mohini said:   1 decade ago
Simple trick: 'Pointer' word is used 3 times. So somehow manage to get * three times in your answer.
(1)

Post your comments here:

Your comments will be displayed after verification.