C Programming - Typedef - Discussion

Discussion Forum : Typedef - General Questions (Q.No. 3)
3.
What is x in the following program?
#include<stdio.h>

int main()
{
    typedef char (*(*arrfptr[3])())[10];
    arrfptr x;
    return 0;
}
x is a pointer
x is an array of three pointer
x is an array of three function pointers
Error in x declaration
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 1 of 2.

Siddu said:   1 decade ago
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].
(2)

Shrikant said:   1 decade ago
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.
(1)

Ankit said:   5 years ago
Array of three pointers means an array will contain three ponters which will points to three address space.

Array of three function pointers it means an array of size 3 which can stores the address of three functions.

Gaurav Kumar Garg said:   1 decade ago
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.
So,
x is an array of three function pointers.

Dev said:   3 years ago
Can anyone explain the program for understanding?

Because I understand x is an array of 3 function pointers, but I don't know how to implement it?

Ram said:   5 years ago
What is the difference between an array of three-pointers and array of three function pointers?

Please tell me.

Rajneesh kumar said:   1 decade ago
Its pointer of pointer concept so which gives value.

So arrays of three function pointer.

Murari jaiswal said:   1 decade ago
*(*
means pointer to pointer which gives value

so arrays of three function pointer

Mtb said:   1 decade ago
If one can give a more detailed description for this, I would appreciate it.

Pragati said:   8 years ago
Hi, please explain this in more simpler way.


Post your comments here:

Your comments will be displayed after verification.