Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Using a loop, determine the size of the string by counting characters until you encounter the null terminating character at the end of the

1. Using a loop, determine the size of the string by counting characters until you encounter the null terminating character at the end of the string.

2. Establish a pointer that points to the beginning character of the string.

3. Establish a pointer that points to the last character in the string, this is the character just before the null terminating character.

4. Using the pointers, swap the first character in the string and the last character in the string.

5. Move the pointers so that the first pointer points to the 2nd character in the string and the second pointer points to the next to last character in the string. Swap these two characters.

6. Repeat this process until all of the characters have been swapped. The string should now be reversed. Add this driver code to your program:

int main( ) { // declare a c-string to reverse char myString[ ] = "Hello world!"; // call the reverser function reverser(myString); // output the result cout << myString << endl; system("PAUSE"); return 0; }

Submit

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions

Question

What are the stages of project management? Write it in items.

Answered: 1 week ago

Question

6. Discuss the steps involved in conducting a task analysis.

Answered: 1 week ago

Question

8. Explain competency models and the process used to develop them.

Answered: 1 week ago