HI All,
have a struct which has a vector defined
typedef struct X_
{
...
..
vector<int> y;
..
} X;
Now in my main program, I first allocate memory to X
Xinstant = (X*) malloc(sizeof(X ));
So do I need to allocate seperate space for the vector?
When I try Xinstant->y.push_back(wh atever), I get runtime errors - seg faults.
Any problem here?
Thanks!
-k
have a struct which has a vector defined
typedef struct X_
{
...
..
vector<int> y;
..
} X;
Now in my main program, I first allocate memory to X
Xinstant = (X*) malloc(sizeof(X ));
So do I need to allocate seperate space for the vector?
When I try Xinstant->y.push_back(wh atever), I get runtime errors - seg faults.
Any problem here?
Thanks!
-k
Comment