-Here we try to reverse the string and store in another string.
Example-
string is "HEY"
reverse is :"YEH"
program-
#include< stdio.h>
#include< string.h>
int main()
{
char s[20],s1[20];
int i=0,len=0;
//input of string
printf("Enter string\n");
scanf("%s",&s);
while(s[i++]!='')
len++;
i=0;
while(s[i]!='')
{
s1[i]=s[len-i-1];
i++;
}
s1[i]='';
printf("String in reverse order is %s",s1);
}
Enter string
Mystring
String in reverse order is gnirtsyM