A Program to Reverse String Using strrev()
In this example, we are giving a program to reverse a string using the strrev() function.
Program to to reverse a string using the strrev() function:
#include <stdio.h>#include <string.h>int main() {char str[100];printf("Enter a string to reverse: ");gets(str);strrev(str);printf("Reverse of the string: %s\n",str);return 0;}
Output:
Enter a string to reverse: abc Reverse of the string: cba