Write a C++ function that will reverse the characters in a C++ string. - The fun
ID: 3574116 • Letter: W
Question
Write a C++ function that will reverse the characters in a
C++ string.
- The function prototype is:
void reverse( char word[] )
Note: - The function can not have any work arrays, i.e.,
the function cannot have any local variables that
are arrays.
Note: - An Algorithm is outlined below:
- have 2 subscripts left and right
- find the '' in the array and set
right to be one less than the
subscript where the '' is located
- set left to 0
- set up a while loop
- inside the while loop switch word[left]
with word[right] - you will need a
work char variable for the swith
- move left up by 1 and move right down by 1
Explanation / Answer
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.