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;
}
Discussion:
14 comments Page 1 of 2.
Murari jaiswal said:
1 decade ago
*(*
means pointer to pointer which gives value
so arrays of three function pointer
means pointer to pointer which gives value
so arrays of three function pointer
Rajneesh kumar said:
1 decade ago
Its pointer of pointer concept so which gives value.
So arrays of three function pointer.
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.
Prasad said:
1 decade ago
I do not understand please explain it.
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].
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)
Svi said:
1 decade ago
What about [10] ? Is it 2-D array ?
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)
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.
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.
Harika said:
9 years ago
Nice @Gaurav Kumar.
Pragati said:
8 years ago
Hi, please explain this in more simpler way.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers