>output is showing nothing after the 'the reversed stringis'
Without looking closely at your code, I would guess that you are copying the null character into index 0 of the array. This makes it an empty string which will print nothing.
I would recommend comparing your code to the following. Try to determine why I chose to do certain operations differently. Using the information on these forums and the FAQ provided on this web site, you can do so easily.
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char str[BUFSIZ];
printf("Enter a string: ");
fflush(stdout);
if (fgets(str, sizeof str, stdin) != NULL) {
size_t s, e;
char *newline = strchr(str, '\n');
if (newline != NULL) {
*newline = '\0';
}
for (s = 0, e = strlen(str) - 1; s < e; s++, e--) {
char save = str[s];
str[s] = str[e];
str[e] = save;
}
printf("The reversed string is: \"%s\"\n", str);
}
return 0;
}