The code compiles without any errors or warnings. However, when I execute the program I get the following output (partial listing only, the rest of the program works just fine):-

Checking the contents of string one.
My name is Alan Turing.
Length: 23

Checking the contents of array temp.

Length: 16

As nothing is printed for array temp I'm assuming that it has not received anything from hidden data member s. (Both are array of char and should be assignment compatible.) Is my understanding correct ? As reverse() is a member function it should have access to private data member "s". Am I overlooking something obvious here ?

I'm wanting to do this in this manner rather than use a library function as I'm just getting started.

I'm kinda surprised no one has responded to this yet. But here goes. The main issue is the dreaded array index vs array size. In member reverse you set local variable 'j' to 'len' which is the length of the character array stored in your string object. You then use 'j' as the index to take from the back end of the stored string and save it into the front end of the local 'temp'. Array indexes start at 0, so for a string length of 16, you want your indexing to run from 0 to 15 ( or in this case from 15 to 0). What you are doing is starting at the null terminator of the string and working to one less than the front of the string (from 16 to 1) so you would never capture the first character. This is also why nothing was being printed as the first element of your reversed character array is the null terminator. This then brings up the next issue you would run into where the character string would not be properly null terminated for printing purposes (unless you wrote your own print to use the objects 'len' member).

A thought popped into my head and I realized there was a different approach with using the null terminator. Since the string that its going into is already null terminated and the second loop structure

as stated originally. but if you modify the second loop to only run from 0 to strength length - 1 you wouldn't need to add the null termination because it already exists in variable memeber 's' at the correct spot.