Write a C Program To Write function to Reverse the string
1: #include<stdio.h>
2: #include<conio.h>
3: void reverse(char[]);
4: int main()
5: {
6: char str[20];
7: clrscr();
8: printf("Enter string : ");
9: gets(str);
10: reverse(str);
11: getch();
12: return 0;
13: }
14: void reverse(char str[20])
15: {
16: int i;
17: printf("%s in reverse order is ",str);
18: for(i=strlen(str)-1;i>=0;i--)
19: printf("%c",str[i]);
20: }
No comments:
Post a Comment