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 :

Leave a Comment

Your email address will not be published. Required fields are marked *

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

Shopping Basket
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
Verified by MonsterInsights