May 18, 2011 at 11:27am UTC
attribute? one and two?
Edit:
1 2 3 4 5 6 7 8 9 10 11 12
typedef struct {
char one;
char two;
} MyStruct;
void main()
{
MyStruct S1;
char *ptrAddress = &S1.one;
}
Is this what you want?
Last edited on May 18, 2011 at 11:29am UTC
May 18, 2011 at 12:03pm UTC
Well, there're two ways you can obtain the address of a member:
1) Create a member function that returns a pointer to a specified member.
2) Create a pointer internally or externally that points to a specified member.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
typedef struct {
char one;
char two;
char *Get_address_one( void )
{
return &one;
}
char *Get_address_two( void )
{
return &two;
}
} MyStruct;
int main( )
{
MyStruct Struct;
// Or use a pointer externally....
char *Member_pointer( &Struct.one );
return 0;
}
Last edited on May 18, 2011 at 12:04pm UTC
May 18, 2011 at 12:24pm UTC
To Framework
Thanks, for explaining, but i'm using C language, that is why internal way by the function is not possible.