C program to reverse a string
C program to reverse a string that a user inputs. If the string is "hello" then, the output is "olleh." C program to reverse a string using strrev, without using strrev, recursion and pointers. A string which remains the same on reversal is a palindrome.
Reverse a string in C using strrev
#include <stdio.h>
#include <string.h>
#include <string.h>
int main()
{
char s[100];
{
char s[100];
printf("Enter a string to reverse\n");
gets(s);
gets(s);
strrev(s);
printf("Reverse of the string: %s\n", s);
return 0;
}
}
No comments:
Post a Comment