Thursday, October 13, 2005

Re: pointer question


Hi Gayathri,

This is the complete solution to your problem. Hope it will solve your
purpose.

int *var[5]; /* Array of pointers to int values */

The array modifier has higher priority than the pointer modifier, so
var is declared to be an array. The pointer modifier applies to the
type of the array elements; therefore, the array elements are pointers
to int values.

int (*var)[5]; /* Pointer to array of int values */

In this declaration for var, parentheses give the pointer modifier
higher priority than the array modifier, and var is declared to be a
pointer to an array of five int values.

join "CPP Sucks" at "Cpp-Sucks@googlegroups.com" and also invite your
friends to join this group, to have healthy discussion on C++.

Regards,
Bhupinder Singh.

0 Comments:

Post a Comment

<< Home