[spoiler] NOOB here [/spoiler]
I am trying to learn pointers, I had a question in regards to how pointers 'point' with vectors, or I think that is my question.
for example lets say I have something like this
1 2 3 4 5 6
|
vector<string> question;
question.push_back("help");
question.push_back("me");
vector<string>* thanks = &question; //pointer
|
So here I made a pointer that points to the address of the array of
the vector question
if I wanted to see this address all I would simply have to do is this
but if I wanted to see the address of a certain element in the vector I
am required to do this
|
cout << &((*thanks)[0]) endl;
|
and really I just want to know what is?
Why can I not just do it like this
|
cout << (thanks)[0] << endl;
|
to me, this would be asking for the
address at index 0. It seems like I would not have to
look at the object itself before pulling the address.
Any help would be great!