Saturday, January 2, 2010

8.10 MORE ABOUT POINTER DECLARATIONS

Several declarations involving pointers are shown below.The individual declarations range from simple to complex.

int *p;     /*p is a pointer to an integer quantity*/


int *p[10];     /*p is a 10-element array of pointers of integer quantities*/


int (*p)[10];     /*p is a pointer to a 10-element integer array */


int *p(void);     /*p is a function that returns a pointer to an integer quantity*/ 


int p(char *a);     /*p is a function that accepts an argument which is a pointer to a character and returns  an integer quantity*/


int *p(char *a);     /*p is a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity*/


int (*p)(char *a);     /*p is a pointer to a function that accepts an argument which is a pointer to a character and returns a pointer to an integer quantity*/


int (*p(char *a))[10];  /*p  is a function that accepts an argument which is a pointer to a character  and returns a pointer to a 10-element integer quantity*/
 
int p(char (*a)[]);  /*p  is a function that accepts an argument which is a pointer to a character array and returns an integer quantity*/


int p(char *a[]);  /*p  is a function that accepts an argument which is an array of pointers to characters and returns an integer quantity*/


int *p(char a[]);  /*p is a function that accepts an argument which is an array of characters and returns a pointer to an integer quantity*/


int *p(char (*a)[]);   /*p is  function that accepts an argument which is a pointer to a character array and returns a pointer to an integer quantity*/   


int *p(char *a[]);  /*p  is a function that accepts an argument which is an array of pointers to characters and returns a pointer to an integer quantity*/


int (*p)(char (*a)[]);  /*p is a pointer to a function that accepts an argument which is is a pointer to a  character array and returns an integer quantity*/


int *(*p)(char (*a)[]);  /*p is a pointer to a function that accepts an argument which is a pointer to a character array and returns a pointer to an integer quantity*/


int *(*p)(char *a[]);  /*p is a pointer to a function that accepts an argument which is an array of pointers to characters and returns a pointer to an integer quantity*/


int (*p[10])(void);  /*p is a 10-element array of pointers to functions;each function returns an integer quantity*/


int (*p[10])(char a);  /*p is a 10-element array of pointers to functions;each function accepts an  argument which is a character, and returns an integer quantity*/


int *(*p[10])(char a);  /*p is a 10-element array of pointers to functions;each function accepts an  argument which is a character, and returns a pointer to an integer quantity*/


int *(*p[10])(char *a);  /*p is a 10-element array of pointers to functions;each function accepts an  argument which is a pointer to a character, and returns a pointer to an integer quantity*/

No comments:

Post a Comment