I have a problem
struct bin
{
int *vector;
bin *next;
};
bin *v = new bin;
and in a function I have:
v->vector = new int[3];
// etc.
The idea is that: if I put v->vector[20] = 3;
it's working, and I don't know why because I expected to have a error. I think i don't understand very wheel what v->vector = new int[1];
is doing .I thought it's allocated 3 int for the vector : v->vector[1],v->vector[2],v->vector[3]
.can someone explain to me why v->vector[20]=3;
doesn't give me an error? Thanks