#include <stdio.h>
#include <string.h>
int main(){
//40. Write a program to reverse string.
printf("\tReverse String");
printf("\n=====================================\n\n");
char str[20];
printf("Enter Your String : ");
gets(str);
printf("\nYour String is : ");
puts(str);
printf("\n-------------------------------------\n");
printf("\nYour Reversed String Is : %s",strrev(str));
printf("\n\n-------------------------------------\n");
return 0;
}
strrev
function from the string.h
library.str
array using the gets
function.strrev
function is called on the str
array to reverse the string.printf
function.