Main Question or Discussion Point
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.OK. So it actually allocates the memory for the pointer and also allocates the memory for the vector that is pointed to, right?
What is the difference between "associating" something with a chunk of memory and allocating the chunk of memory to that thing?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.