Thursday, 13 October 2016

to reverse a string or word without using strrev() function

#include<stdio.h>
#include<string.h>
int main()
{
char a[10],b[10];
int i,j,len;
printf("enter first  the string");
gets(a);
len=strlen(a)-1;
for(i=0;a[i]!='\0';i++)
{
b[len]=a[i];
len--;

}
b[len]='\0';
printf ("the reverse string is :");
puts(b);
}

No comments:

Post a Comment