C Program to Reverse a String using strrev()

The strrev() function is not a standard C program function. However, there are various ways to reverse a string in C. If you want to use strrev(), you need to include the <string.h> header, and you can implement it like this:

Program :

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char input[20];
printf(“Enter the String : “);
gets(input);
printf(“\nString Before Reverse : %s”,input);
strrev(input);
printf(“\nString After Reverse : %s”,input);
getch();
}

Output :

1 thought on “C Program to Reverse a String using strrev()”

Leave a Comment

Your email address will not be published.

Shopping Basket
Verified by MonsterInsights