Question: 2. Write a function that reverses the string supplied as a parameter, i.e., the very first symbol of the string becomes the last one, the

2. Write a function that reverses the string supplied as a parameter, i.e., the very first symbol of the string becomes the last one, the second one next to the last, and so on. The parameter is an array of elements of type char. The function should change the array in-place, i.e., it has to change the actual array passed as the parameter. You can assume that the function receives a real string, i.e., a valid array of characters with '\0' character indicating the end of the string. This is the function's declaration: void ReverseString(char str[]); Please keep in mind that str could be an empty string too. In that case str[0] would be equal to '\0'. Hint: You can use strlen(str) to return the length of the string. In order to use it, you have to put the following #include directive to your source file: #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
