Coming from a Java background, I am trying to understand pointers/references in C++. I am trying to return a vector from a function. Writing:
vector<char*> f(){
vector<char*> vec;
return vec;
}
would return the copy of the vector, correct? A better way would be to return a pointer to vector like this:
vector<char*>* f(){
vector<char*>* vec = new vector<char*>;
return vec;
}
Am I correct, or is this totally wrong?