Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that prompts the user for a string and then printsthe string rev

ID: 3615392 • Letter: W

Question

write a program that prompts the user for a string and then printsthe string reversed. You may assume the word entered will notbe more than 19 characters long. Declare your stringaccordingly.

You must use a function called wordReverse to do the actualreversing. This function should not return anything. Its only parameter should be the string to reverse. Do notmake any assumptions about the length of the string. You mustuse the null character to determine where the string ends. You may use the strcpy function from string.h, but it is notrequired.
A sample run of the program is below. User input is in boldfor clarity.

Enter a word: midterm The word reversed is: mretdim

Explanation / Answer

please rate - thanks #include #include #include void wordReverse(char[]); main() {char array[20]; char *in; printf("Enter a string: ");      in=gets(array); printf("Before reversed: ");    puts(in);    wordReverse(array); printf(" After reversed: "); puts(in);                getch();          //hang a read to keep DOS window from closing return 0; } void wordReverse(char array[]) {int i,n=0; char temp; while(array[n]!='')       n++; for(i=0;i