C Pointer Question: &(*struct->struct)

Posted by NTek on Stack Overflow See other posts from Stack Overflow or by NTek
Published on 2010-04-22T17:48:17Z Indexed on 2010/04/22 17:53 UTC
Read the original article Hit count: 253

Filed under:
|
|

I have a struct defined with the structure as follows (names are different)

struct str1
{
   int field1;
   struct str2;
}

And I have a *str1 in a function. I'd like to get a pointer to str2.

So I tried &(str1->str2) and was hoping this would return a pointer to str2. Is this incorrect? It doesn't seem to be working. How would I get a pointer to str2 if given a pointer to str1?

© Stack Overflow or respective owner

Related posts about pointers

Related posts about pointer