Hi All,
I can't seem to wrap my head around this one.
I have a pointer,
int *x;
which I can assign:
x = &y;
Now, I can send this variable by reference like so:
some_function( &x );
But, what do I do if x is contained within a pointer to a struct (or class
for that matter)?
struct c {
int *x;
}
such that a pointer to c (c *cptr) would access it like this:
cptr->x = &y;
but now, if I try to send this by reference:
some_function( cptr->&x )
I get an error: expected unqualified-id before '&' token. How do I
properly send this variable by reference?
Thanks for any help!
Scott
I can't seem to wrap my head around this one.
I have a pointer,
int *x;
which I can assign:
x = &y;
Now, I can send this variable by reference like so:
some_function( &x );
But, what do I do if x is contained within a pointer to a struct (or class
for that matter)?
struct c {
int *x;
}
such that a pointer to c (c *cptr) would access it like this:
cptr->x = &y;
but now, if I try to send this by reference:
some_function( cptr->&x )
I get an error: expected unqualified-id before '&' token. How do I
properly send this variable by reference?
Thanks for any help!
Scott
Comment