so I've been playing around with C++. I was trying to figure out if it's possible to define a structure in the definition of another structure. And here's my code.
#include <iostream>
using namespace std;
int main(){
    struct structure1{
        int integer1;
        struct structure2{
            int integer2;
        }struct2;
    }struct1;
    structure1 *s1 = &struct1;
    s1->integer1 = 50;
    cout<<"STRUCTURE ONE'S INTEGER: "<<s1->integer1<<endl;
    cout<<"STRUCTURE ONE'S STRUCTURE2.integer2: "<<s1->struct2.integer2;
}
OUTPUT:
$ ./a.out
STRUCTURE ONE'S INTEGER: 50
STRUCTURE ONE'S STRUCTURE2.integer2: 0
From what I saw in the output it had seemed to be working. But I just don't understand why or how it worked. Is it good practice? Is there any application to this?
Thanks!
 
     
    