Object Oriented Programming20755 marksPointers
Write a member function called reverse() that reverses a string (an array of character). Use a for loop that swaps the first and last characters, then the second and next-to-last character and so on. The string should be passed to reverse() as an argument.
Write a member function called reverse() that reverses a string (an array of character). Use a for loop that swaps the first and last characters, then the second and next-to-last character and so on. The string should be passed to reverse() as an argument. [5]
A string in C++ is a character array. To reverse it, we swap the character at the first position with the character at the last position, then the second with the second-to-last, and so on, continuing until we reach the middle of the string. --- --- Suppose the input string is "HELLO" (length = 5...