38 votes 38 votes What does the following C-statement declare? int (*f) (int * ); A function that takes an integer pointer as argument and returns an integer A function that takes an integer as argument and returns an integer pointer A pointer to a function that takes an integer pointer as argument and returns an integer A function that takes an integer pointer as argument and returns a function pointer Programming in C gatecse-2005 programming programming-in-c pointers easy isro2017 + – Kathleen asked Sep 22, 2014 • retagged Dec 9, 2022 by Lakshman Bhaiya Kathleen 20.7k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply KUSHAGRA गुप्ता commented Dec 26, 2019 reply Follow Share https://www.youtube.com/watch?v=LPABbqfElA8&list=PLsFENPUZBqipuTJXgm7xAOR0UnY_8OY07&index=31 22 votes 22 votes shashankrustagi commented Jan 16, 2021 reply Follow Share B,D are incorrect as they are not returning INT A is incorrect because it is not a function, LOL, it is a function pointer hence C 3 votes 3 votes Please log in or register to add a comment.
Best answer 57 votes 57 votes A function that takes an integer pointer as argument and returns an integer $\Rightarrow int \ f (int *)$ A function that takes an integer as argument and returns an integer pointer $\Rightarrow int * f (int )$ A pointer to a function that takes an integer pointer as argument and returns an integer $\Rightarrow$ int (*f) (int * ); So, answer is C. Akash Kanase answered Nov 28, 2015 • edited Jun 15, 2018 by Milicevic3306 Akash Kanase comment Share Follow See all 17 Comments See all 17 17 Comments reply learncp commented Dec 30, 2015 reply Follow Share 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.? 1 votes 1 votes saurabh rai commented Oct 11, 2016 reply Follow Share 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 votes 6 votes VS commented Nov 8, 2017 reply Follow Share @saurabh rai 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. 16 votes 16 votes Puja Mishra commented Dec 8, 2017 reply Follow Share #VS can u write a program on it ?? int ( * f(int *) ) () 0 votes 0 votes Ayush Upadhyaya commented Dec 10, 2017 reply Follow Share This can help https://stackoverflow.com/questions/10758811/c-syntax-for-functions-returning-function-pointers 5 votes 5 votes Ashish Subscription commented Jan 15, 2018 i reshown by Ashish Subscription Oct 4, 2018 reply Follow Share Read this, http://cseweb.ucsd.edu/~ricko/CSE131/rt_lt.rule.html I call this "Brahmaastra" technique for solving such question. 32 votes 32 votes mehul vaidya commented Jul 15, 2018 reply Follow Share thanks ashish 0 votes 0 votes mehul vaidya commented Jul 15, 2018 reply Follow Share Ayush Upadhya thanks 0 votes 0 votes None ... commented Aug 3, 2018 reply Follow Share Declaration of D will be ( * f(int *) ) () ... am i right ?? 0 votes 0 votes talha hashim commented Aug 23, 2018 reply Follow Share ashish bhai u r great 0 votes 0 votes jaco commented Oct 4, 2018 reply Follow Share quiet interesting "astra" 1 votes 1 votes Gurdeep Saini commented Oct 26, 2018 reply Follow Share saurabh rai and VS comment are conflicting i think vs is correct one 0 votes 0 votes indra kumar sahu commented Jun 4, 2020 reply Follow Share amazing bro 0 votes 0 votes jatinmittal199510 commented Mar 18, 2021 reply Follow Share Thanks, man. 0 votes 0 votes tirth_patel commented Nov 24, 2021 reply Follow Share Ashish bhai thanks a lot for this “Brahmastra” ☺ 1 votes 1 votes Kiyoshi commented Jun 23, 2022 i edited by Kiyoshi Jun 23, 2022 reply Follow Share A function that takes an integer pointer as argument and returns a pointer to a function that takes no arguments and returns integer.f(int*)A function that takes an integer pointer as argument and returns a pointer to a function that takes no arguments and returns integer.int (*f(int*))() 1 votes 1 votes Abhrajyoti00 commented Oct 27, 2022 reply Follow Share Thanks @Ashish Subscription for the wonderful "Brahmastra"More on function pointers : Lecture 08 - Function Pointers (cmu.edu) 0 votes 0 votes Please log in or register to add a comment.
7 votes 7 votes Answer is option C... This is the proptotype to declare a pointer to a function anchitjindal07 answered May 7, 2017 anchitjindal07 comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes http://www.geeksforgeeks.org/complicated-declarations-in-c/ Good information to go through Answer C Regina Phalange answered Apr 8, 2017 Regina Phalange comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes By clockwise spiral rule, answer is C A very good read to read function description http://c-faq.com/decl/spiral.anderson.html Rohit Gupta 8 answered Dec 12, 2017 Rohit Gupta 8 comment Share Follow See all 0 reply Please log in or register to add a comment.