Thursday, November 29, 2012

Pointers in C++

int *p;

p is a pointer to an integer quantity

int *p[10];

p is a 10 elements array of pointers to integer quantities

int (*p)[10];

p is a pointer to a 10 element integer array

int *p(void);

p is a function that returns pointer to an integer quantity and accepts nothing

int p(char *a);
p is 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 which 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 which accepts an argument as a pointer to a character and returns an integer quantity
int (*p(char *a))[10];
p is function that accepts argument which is pointer to a character and returns a pointer to a 10 element integer array
int p(char (*a)[]);
p is a function which accepts an argument which is a pointer to a character array and returns an integer quantity

int p(char *a[]);
p is a function which accepts an argument which is an array of pointers to characters and returns an integer quantity
int *p(char a[]);
p is a function which accepts a character array as argument and returns a pointer to an integer quantity
int *p(char (*a)[]);
p is function which accepts an argument which is a pointer to an array of characters and it returns a pointer to an integer quantity
int *p(char *a[]);
p is a function which accepts argument as an array of character pointers and returns a pointer to an integer quantity
int (*p)(char (*a)[]);
p is a pointer to a function which takes an argument which is a pointer to character array and  returns an integer quantity
int *(*p)(char (*a)[]);
p is a pointer to a function which takes argument which is pointer to a character array and returns a pointer to an integer quantity
int *(*p)(char *a[]);
p is a pointer to a function which takes argument which is an array of pointers to characters and returns pointer to an integer quantity
int (*p[10])(void);
p is a 10 element array of pointers to functions which does not take anything as argument and each function returns an integer quantity 

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

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








No comments:

Post a Comment