Click to See Complete Forum and Search --> : getting adress of an int from a pointer to a pointer to a struct


PolteRGeisT
04-03-2003, 12:07 PM
struct foo {
int var;
};

struct foo *str[10];


How do I get the adress of the var int from that pointer array?

bwkaz
04-03-2003, 02:11 PM
What I'd do is:

&(str[0][0].var); You could also do (if you knew that you would always use the first element of str[0] -- or if you don't intend each element of str to be an array itself):

&(str[0]->var);