Question: Write a complete C program which must: Implement the function void swapChars(char* str) which receives a string (array of characters) and modifies the string

Write a complete C program which must:  Implement the function void swapChars(char* str) which receives a

Write a complete C program which must: Implement the function void swapChars(char* str) which receives a string (array of characters) and modifies the string by swapping its first n/2 characters with its last n/2 characters. Examples: 1234567 becomes 5674123 aabb becomes bbaa aabcc becomes ccbaa AhmadAlami becomes AlamiAhmad This function does not print anything. Read from the user (in main()) a string and then print the string after calling function swapChars appropriately. Use pointers and pointer arithmetic only. The use of array notation and/or functions from the string.h library is not allowed.

Step by Step Solution

3.45 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This question can be solved just by using arithmetics although there are se... View full answer

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 Programming Questions!