#include<stdio.h>
#include<conio.h>
void reverse(char *);
void main()
{
char str[90];
clrscr();
printf("enter string: ");
gets(str);
reverse(str);
getch();
}
void reverse(char *str1)
{
int i,len=0;
for(i=0; str1[i] != '\0'; i++)
{
len++;
}
printf("\n\nreverse string: ");
for(i=len; i != -1; i--)
{
printf("%c",str1[i]);
}
}
/* output:
enter string: khyati foundation
reverse string: noitadnuof itayhk
*/
No comments:
Post a Comment