C Programming - Typedef - Discussion


What is x in the following program?


int main()
    typedef char (*(*arrfptr[3])())[10];
    arrfptr x;
    return 0;

[A]. x is a pointer
[B]. x is an array of three pointer
[C]. x is an array of three function pointers
[D]. Error in x declaration

Answer: Option C


No answer description available for this question.

Murari Jaiswal said: (Oct 22, 2010)  
means pointer to pointer which gives value

so arrays of three function pointer

Rajneesh Kumar said: (Mar 6, 2011)  
Its pointer of pointer concept so which gives value.

So arrays of three function pointer.

Mtb said: (Sep 9, 2011)  
If one can give a more detailed description for this, I would appreciate it.

Prasad said: (Sep 23, 2011)  
I do not understand please explain it.

Siddu said: (Nov 3, 2011)  
The return value of the function whose function pointer can be any of arrfptr[n]will be a pointer to an array of 10 characters.

The declaration can interpreted as "type of the array to be returned by function(char) (Returning char pointer(*)(function pointer name(*arrfptr)[size of the array of function pointers](3)(parameters)(void))[size of the array which will be returned from the function].

Svi said: (Mar 7, 2012)  
What about [10] ? Is it 2-D array ?

Shrikant said: (May 13, 2013)  
No. Its a single dimension array. Initially array is represented as the ptr array. I mean A[10]--->if you used A alone then it will become a pointer. So *(*(A then *(*(ptr of an array. Finally we can say it as three pointer function.

Gaurav Kumar Garg said: (Jan 19, 2014)  
typedef char (*(*arrfptr[3])())[10];

Meaning of this is

arrfptr is array of 3 function pointer which return array of 10 dimension whose type is char.
x is an array of three function pointers.

Harika said: (Oct 16, 2016)  
Nice @Gaurav Kumar.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.