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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>