Redirected
2,435 views

4 Answers

Best answer
4 votes
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.

selected by
4 votes
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

2 votes
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

edited by
0 votes
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 *().

Related questions

3 votes
3 votes
1 answer
1
Storm_907 asked Apr 16, 2023
441 views
Please explain this question void main() { int a =300; char *ptr = (char*) &a ; ptr++; *ptr=2; printf("%d" , a); }
4 votes
4 votes
4 answers
3
Manoj Kumar Pandey asked May 22, 2019
797 views
https://gateoverflow.in/?qa=blob&qa_blobid=14433986388826671915int main() { int a = 10; int *b = &a; scanf("%d",b); printf("%d",a+50); }What will be the Output of the fol...