197. C Program To find the Reverse of A Given String.
How does this program work?
- This Program is used to find the reverse of a given string.
Here is the code
#include <stdio.h>
#include <string.h>
int main()
{
char Str[100], RevStr[100];
int i, j, len;
printf("\n Please Enter any String : ");
gets(Str);
j = 0;
len = strlen(Str);
for (i = len - 1; i >= 0; i--)
{
RevStr[j++] = Str[i];
}
RevStr[i] = '\0';
printf("%s",Str);
printf("\n String after Reversing = %s", RevStr);
return 0;
}