In this C program, we will learn how to write a program to reverse a string using strrev() and using strlen() functions.
Here is the code of the program to reverse a string using strrev() and using strlen() functions.
/* C Program to Reverse String with using strrev() and using strlen()*/
#include<stdio.h>
#include<string.h>
void main()
{
char str[100];
printf("Enter a String: ");
gets(str);
strrev(str);
printf("Reverse String is = %s",str);
}
Enter a String: Tutorialsrack
Reverse String is = kcarslairotuT
--------------------------------
Process exited after 5.403 seconds with return value 33
Press any key to continue . . .
Comments