C Program String Reverse Using strrev

By | March 12, 2020

C Program String Reverse Using strrev

/* C Program Reverse a string
  using strrev() predefined function
  
  www.easycodebook.com
  */
#include <stdio.h>
#include <string.h>
int main()
{
   char str[100];

   printf("Please, Enter a string to reverse\n");
   gets(str);

   strrev(str);

   printf("The Reverse string is : %s\n", str);

   return 0;
}

Output

Please, Enter a string to reverse
ABCDEF
The Reverse string is : FEDCBA

 

Leave a Reply

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