I basically have a dynamic char array that stores names and have declared it as char **names
.
I have a variable called namesnumber
which is used to set the size of the names
array.
For example,
namesnumbers = 5
names = new char*[namesnumbers];
for (int i=0; i<namesnumbers; i++)
{
names[i] = new char[65];
strcpy(names[i], actualName);
}
names = {Mike, Sam, Mark, Bill, George}
This is my return method, however it only returns a memory address and not the actual namess
const char** getNames()
{
return names;
}
I want my getNames()
method to return the 5 names.