#include<stdio.h>
void string_reverse(char *p)
{
char *q,t;
q=p;
while(*q!='\0')
{
q++;
}
q--;
while(p<=q)
{ t=*p;
*p=*q;
*q=t;
p++;
q--;
}
}
int main()
{
char a[100];
printf("Enter a string\n");
gets(a);
string_reverse(a);
printf("The reversed string is: ");
puts(a);
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter a string
EviL
The reversed string is: LivE