Consider the following C++ codes :
using namespace std;
vector<char*> aCharPointerRow;
aCharPointerRow.push_back("String_11");
aCharPointerRow.push_back("String_12");
aCharPointerRow.push_back("String_13");
for (int i=0; i<aCharPointerRow.size(); i++) {
cout << aCharPointerRow[i] << ",";
}
aCharPointerRow.clear();
After the aCharPointerRow.clear();
line, the character pointer elements in aCharPointerRow
should all be removed.
Is there a memory leak in the above C++ code ? Do I need to explicitly free the memory allocated to the char* strings ? If yes, how ?
Thanks for any suggestion.