The program must take the reverse of each of the words inside the string and outputs the resultant string without using any string library function except strlen(), gets(), puts(). In the main function, input one string and pass it to a function named cleanString. This function removes the non-alphabetic characters and writes the rest into a new character array (i.e. non-alphabetic characters are +, - ?, *, 1,2,3,…). After receiving a cleaned array, you should call another function named reverseWords. This function takes and returns the string as a parameter. String should be arranged in a reversed order for each word. All operations in this function should take place on the same string, you shouldn’t be using a temporary array for the reverse operation. Finally, print the result in the main function.
Sample run:
Enter first string: This-?=*is__12the**23%third?[]homework--_?().
Cleaned string: This is the third homework
Reversed string: sihT si eht driht krowemoh
Comments
Leave a comment