C Program to Reverse String !!!
/* Program to reverse string */
#include <stdio.h>
#include <string.h>
int main()
{
int i, len, a;
char str[25] = "techterabyte.com";
char revstr[25] = "\0";
// finding length of string str
len = strlen(str);
a = len-1;// loop till string length
for(i=0;i<=len;i++) {
revstr[a] = str[i];
a--;
}
printf(" Reversed String = %s", revstr);
return(0);
}
Output
Reversed String = moc.etybarethcet
No comments:
Post a Comment