C Programming - Complicated Declarations - Discussion
Discussion Forum : Complicated Declarations - General Questions (Q.No. 8)
8.
Declare the following statement?
"A pointer to a function which receives nothing and returns nothing".
"A pointer to a function which receives nothing and returns nothing".
Discussion:
8 comments Page 1 of 1.
Rani said:
7 years ago
Please tell me the difference between pointer to function and pointer function.
Vinay said:
9 years ago
@Saran
You are the great man your trick working everywhere. Thank you very much.
You are the great man your trick working everywhere. Thank you very much.
Kiran Bhosale said:
9 years ago
This declaration is wrong and will give the compilation error "expected declaration specifiers or \'. \' before \'*\' token", i.e. there is no data type before * in (*).
If we replace this expression with something like this "void * (*ptr) (int *)", then it would be pointer to function that "returns void pointer and accepts integer pointer as an argument".
If we replace this expression with something like this "void * (*ptr) (int *)", then it would be pointer to function that "returns void pointer and accepts integer pointer as an argument".
Siddu said:
1 decade ago
"void *(*ptr)(*)" What does it mean?
Yug Verma said:
1 decade ago
Yes, *ptr()-> ptr is a pointer function which returns void and void (*ptr)() -> ptr is a pointer to a function which returns void.
Patrick said:
1 decade ago
Is there any difference between void *ptr() and void (*ptr)()?
Manas said:
1 decade ago
@Saran you are great.
Saran said:
1 decade ago
Simple trick is that there is only one pointer is mentioned and pointer is represented by *. So the answer is void(*ptr)().
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers