What is the diffrence beatween say:
Vector<int*> myVector[5] and Vector<int> *myVector[5]
The way I see it, in the first case, my vector will contain 5 counts of pointers to ints.
In the second case, myVector is a pointer to an array of 5 ints.
The reason I ask is because I wrote some code a while back and now I don’t understand it any more.
With Vector<int> *myVector[5], why can I do
for(int i = 0; i < 5; i++)
{
myVector[i] = new Integer(13);
}
I know for a fact that the operator new returns a pointer, and then I’m storing it in myVector, but a pointer to an int is not an int right?
I’m confused.
Creates an array of size 5 to
Vector<int*>.Creates an array of 5 pointers to
Vector<int>.Instead, Using vector to vector is a cleaner soution: