I have a struct which is as follows:
struct octNode{
octNode* parent;
octNode* child[8];
std::vector<int> pointIndex;
//constructor of the struct
octNode()
{
memset(parent,0,sizeof(parent));
memset(child,0,sizeof(child));
}
};
But this throws a run-time error: 0xC0000005: Access violation writing location 0xcdcdcdcd. Unhandled exception at 0x771115de in Octree_octnode_0113.exe: 0xC0000005: Access violation writing location 0xcdcdcdcd.
The access violation occurs in the creation of the empty vector. Is there a way to initialize the vector in the constructor so that the error doesnt occur?
parentisn't pointing anywhere and it isn't initialized. How did you expect this to make sense?