if I have a vector inside another structure, how can I initiate or obtain the value of an element insides the struct1
typedef struct_1 {
unsigned v1;
unsigned v2;
int v3;
}struct1;
typedef struct_2{
int v4;
unsigned v5;
vector <struct1> s1;
} struct2;
Let’s say to obtain v4, v5 I can do this:
struct2 *p = new struct2();
p->v4;
p->v5;
How do I access v1 and v2?
you first need to “add” some elements into s1 vector, as by having a
struct2object pointed byp, thes1vector is initialized to empty.