ehrenfest
- 2,001
- 1
Code:
std::vector<float> *my_vectors;
does this create a vector of pointers or a pointer to a vector?
std::vector<float> *my_vectors;
No. The statement int index; creates a variable named index. While this variable is associated with a chunk of memory, this declaration statement does not allocate memory, at least not in the sense you are thinking. I certainly hope you will not write code that accesses the value of the variable index before you assign it a value.ehrenfest said:OK. So it actually allocates the memory for the pointer and also allocates the memory for the vector that is pointed to, right?
D H said:his declaration statement associates a variable with a chunk of memory. It does not, however, allocate memory, at least not in the sense you appear to be thinking.