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.
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?
Because I understand x is an array of 3 function pointers, but I don't know how to implement it?
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.
Array of three function pointers it means an array of size 3 which can stores the address of three functions.
Ram said:
5 years ago
What is the difference between an array of three-pointers and array of three function pointers?
Please tell me.
Please tell me.
Varshini said:
6 years ago
Then what about [10], is it same as [3]?
Pragati said:
8 years ago
Hi, please explain this in more simpler way.
Harika said:
9 years ago
Nice @Gaurav Kumar.
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.
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)
Svi said:
1 decade ago
What about [10] ? Is it 2-D array ?
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)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers