Question: Create a function called - swapChars which uses a pointer to swap one char for another. Your function should take three parameters. The first parameter

Create a function called-swapChars which uses a pointer to swap one char for another. Your function should take three parameters. The first parameter is the string to search through. The second parameter is the char to search for. The third parameter is the char to swap with. Your function should swap the first occurrences of the two characters. For example, Suppose you have the following String "this is a test" and the first char to swap is 'h' and the second char to swap is 's' Your function should then arrange the String like this: tsih is a test. Note: You must use pointers to perform this task. This means the use of array notation will not be allowed. You must swap the characters. Replacing characters with the parameters is not acceptable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!