C program to reverse a string

c programming tutorial toreverse string program

reverse.c
#include <stdio.h>
#include <string.h>
 
int main()
{
   char arr[100];
 
   printf("Enter a string to reverse\n");
   gets(arr);
 
   strrev(arr);
 
   printf("Reverse of entered string is \n%s\n",arr);
 
   return 0;
}


Output-


Enter a string to reverse
I love coading
Reverse of entered string is 
gnidaoc evol I

0 comments:

Post a Comment

My Instagram