3 3 votes Programming in C pointers programming-in-c + – Samujjal Das 3.9k views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Prashant. commented Dec 1, 2016 reply Follow flag ............................. 0 0 replyShare Kantikumar commented Dec 31, 2016 reply Follow flag Ans : B? 0 0 replyShare Please log in or register to add a comment.
Best answer 4 4 votes int (*q(char *))[] means q is a function that takes char * as argument and returns a pointer to an array of integer. Option (C) means q is a pointer to a function that takes char * as argument and returns an array of integers. So, None of the above is correct. mcjoshi answered Dec 1, 2016 • selected Dec 1, 2016 by srestha mcjoshi comment Share Follow See all 3 Comments 3 3 Comments reply srestha commented Dec 1, 2016 reply Follow flag @joshi plz chk now. Are u using something other formula? 1 1 replyShare mcjoshi commented Dec 1, 2016 reply Follow flag Now your answer is correct. 0 0 replyShare utk0203 commented Jan 6, 2017 reply Follow flag That spiral rule. 2 2 replyShare Please log in or register to add a comment.
4 4 votes 1. int (*q(char*)) = q is a function which take character pointer as argument and return pointer to Integer. 2. int *q(char*)[] = declare q as function (pointer to char) returning array of pointer to int 3. int (*q)(char*)[] = declare q as pointer function (pointer to char) returning array of int Reffer :http://cdecl.org/ Correct would be : int (*q(char *))[] = declare q as function taking character pointer as argument and returning pointer to array of int Prashant. answered Dec 1, 2016 Prashant. comment Share Follow See all 4 Comments 4 4 Comments reply srestha commented Dec 1, 2016 reply Follow flag difference is array of pointer and pointer to an array between B) and D) 0 0 replyShare Prashant. commented Dec 1, 2016 reply Follow flag array of pointer : each element is pointer.[inside array] Pointer to an array : address of array. 1 1 replyShare nadeshseen commented Sep 10, 2019 i edited by nadeshseen Sep 11, 2019 reply Follow flag @Prashant. 2. and 3. are not valid C statements I tried compiling them. int (*q(char *))[] this is correct. Still finding the reason. 0 0 replyShare Ritik gupta commented Dec 2, 2020 reply Follow flag This might help understanding complex pointer type declarations http://www.unixwiz.net/techtips/reading-cdecl.html 0 0 replyShare Please log in or register to add a comment.
2 2 votes Ans D) C)Here q is a $\color{blue}{ pointer}$ $\color{blue}{ to}$ $\color{blue}{ a}$ $\color{blue}{ function}$ passing a pointer to a charecter as argument which returns array of integer . B)q is a function passing passing a pointer to a charecter as argument which returns $\color{blue}{ array}$ $\color{blue}{ of}$ $\color{blue}{ integer}$ $\color{blue}{ pointer}$ https://gateoverflow.in/35193/regarding-pointers http://c-faq.com/decl/spiral.anderson.html https://gateoverflow.in/58327/doubt-on-array-of-pointers srestha answered Nov 30, 2016 • edited Dec 1, 2016 by srestha srestha comment Share Follow See all 3 Comments 3 3 Comments reply nadeshseen commented Sep 10, 2019 reply Follow flag @srestha B and C are not valid C statements. A function cannot return either array of integers or an array of integer pointers. 0 0 replyShare srestha commented Sep 10, 2019 reply Follow flag where u got this? 0 0 replyShare nadeshseen commented Sep 11, 2019 reply Follow flag @srestha I compiled it. But I was WRONG at saying a function cannot return array. 0 0 replyShare Please log in or register to add a comment.
0 0 votes answer is A as its a function that accepts pointer to character as argument i.e. q(char *) and returns a pointer to integer array i.e. int *(). vashisht answered Dec 31, 2016 vashisht comment Share Follow See 1 comment 1 1 comment reply Abhijit Borah commented Jan 3, 2017 reply Follow flag D. None of these Corrected Declaration should be : int (*q(char *))[] 1 1 replyShare Please log in or register to add a comment.