#include<stdio.h>
#include<conio.h>
#include<string.h>
char reverse(char *p);
void main()
{
int i;
char str[10];
clrscr();
printf(" \n \n Enter the String: \t ");
gets(str);
reverse(str);
getch();
}
char reverse(char *p)
{
int j,l;
l = strlen(p);
printf(" \n \n String in reverse is: \t ");
for(j = l - 1; j >= 0; j--)
{
printf("%c",p[j]);
}
return 1;
}
OUTPUT:
Enter the string: Kolaveri
String in reverse is: irevalok
ALSO READ:
Sample C Program To Swap Two Strings Using strcpy() Function.
Sample C Program To Sort A Given Number Of Strings Using strcmp() Function.
Sample C Program To Display Array Of Strings.
Sample C Program To Convert String To An Integer Using atoi() Function.
Sample C Program To Find The Length Of A String.
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com