I have a private data member that is an array of characters that stores a bunch of numbers (123456789). The data member name is listNum. I am writing a method in my class that takes no parameters and returns the listNum data member but I'm having problems because it is only returning the first character of the array. I realize that when I return the name of a character array that it converts the name into a pointer to the first element of the array, hence why I am getting only the first number. I don't know how to get it to return the entire array of characters though. I know how to output them by looping through the array and such, but not return.
This does not return the array (i.e. a copy of the array), but a pointer to the first element, which would allow changing to original array.
Use std::string or std::vector<char> instead.