Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 Examples: Input: "Hello" Output: "olleH" Input: "CAT" Output: "TAC" Input: "A" Output: "A
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started