Using typedef with Pointers to Functions

1.  typedef int ( * ( * arr2d_ptr ) ( ) ) [3][4] ;

arr2d_ptr p ;

Ans: p is a pointer to a function returning a pointer to a 2-D int array.

2. typedef int ( * ( * ( * ptr2d_fptr ) ( ) ) [10] )( );

ptr2d_fptr p ;

Ans: p is a pointer to a function returning a pointer to an array of 10 pointers to function returning an int.

3. typedef char ( * ( * arr_fptr[3] ) ( ) ) [10] ;

arr_fptr x ;

Ans: x is an array of 3 pointer to function returning a pointer to an array of 10 chars.

4. typedef float* ( * ( * ( * ptr_fptr ) ( ) ) [10] )( );

ptr_fptr q ;

Ans: q is a pointer to function returning a pointer to an array of 10 pointers to functions returning a float pointer.

Subscribe / Share

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

Powered by Yahoo! Answers