nested structures

How do I access struct s3 from main().

Thanks H. Hampton

1
2
3
4
5
6
7
8
9
10
11
12
13
struct s1
{
    int a;  int b;  int c;
    void f1(int*);
    struct s3
    {   double arch;
        int x;
        int y;
        int z;
    };
} ;

struct s1::s3;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct s1
{
    int a;  int b;  int c;
    void f1(int*);
    struct s3
    {   double arch;
        int x;
        int y;
        int z;
    };
};

s1 MyOwnStruct;


int main()
{
     MyOwnStruct.s3.x;
}



s1::s3
s3 is a member of s1, but it is not a member variable of s1, hence you cannot access s3 through an instance of s1
Thanks
Topic archived. No new replies allowed.