#include<stdio.h>

#define SIZE 20

void reverseString(char s[ ]);

int main( void )
{
char str[SIZE];

printf("Enter a string: ");
scanf("%19s", str);
reverseString(str);
printf("The reversed string is \"%s\"\n", str);

return 0;
}

void reverseString(char s[ ])
{
char temp[SIZE];
int count = 0;
int i, j;

/* count the length of the string */
while (s[count] != '\0') {
    count++;
}

/* reverse the string */
j = 0;
for (i = count-1; i >= 0; i--) {
    temp[j++] = s[i];
}
temp[j] = '\0';

/* copy the reversed string back */
for (j = 0; j < count; j++) {
    s[j] = temp[j];
}

}



