Saturday 30 March 2013

Some Complex Pointers

Some Complex Pointers


(2) How to read following pointer?
float (* ptr)(int)
Answer: Assign the priority considering precedence and associative.


Now read it following manner:
ptr is pointer to such function whose parameter is int type data and return type is float type data.
Assign the priority of each function parameter separately and read it also separately.

(3) How to read following pointer?

void (*ptr)(int (*)[2],int (*) void))

Answer:

Assign the priority considering rule of precedence and associative.


Now read it following manner:

ptr is pointer to such function which first parameter is pointer to one dimensional array of size two which contentint type data and second parameter is pointer to such function which parameter is void and return type is int data type and return type is void


(4) How to read following pointer?

int ( * ( * ptr ) [ 5 ] ) ( )

Answer:
Assign the priority considering rule of precedence and associative.



Now read it following manner:

ptr is pointer to such array of size five which content are pointer to such function which parameter is void and return type is int type data.



(5) How to read following pointer?

double*(*(*ptr)(int))(double **,char c)

Answer:
Assign the priority considering rule of precedence and associative.

 


Now read it following manner:

ptr is pointer to function which parameter is int type data and return type is pointer to function which first parameter is pointer to pointer of double data type and second parameter is char type data type and return type ispointer to double data type.


(6) How to read following pointer?

unsigned **(*(*ptr)[8](char const *, ...)

Answer: 
Assign the priority considering rule of precedence and associative.

 


Now read it following manner:

ptr is pointer to array of size eight and content of array is pointer to function which first parameter is pointer to character constant and second parameter is variable number of arguments and return type is pointer to pointer of unsigned int data type. 


No comments:

Post a Comment