Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago