Categories




C program to reverse string / atozprogram

” C program to reverse string”¬†using string function is one easy way to reverse string. There is also other process of reversion. But in this¬† program we have use string function to reverse function.So first if our are unknown about reverse function read the following description.

The string function strrev() is used to reverse a string. It take only one string and return in reverse order.
Syntax :

strrev(string);

Here I have done two programming to reverse string . First one is little difficult and I think second one is little easier to understand. So without delay let’s to our programming.

C Program To Reverse String / String Reverase :


 
 #include<stdio.h>  
#include<conio.h>
#include<string.h>
int main()
{
 char string1[30];
 printf("n Enter first string:");
 gets(string1);
 strrev(string1);
 printf("n Reverse string %s:",string1);
 getch();
} 

Above programming is¬† little difficult but if our are already known about string you can easily understand this program . In program I have “string1[]” to store string value. And ask user to enter string and using “strrev” function string function easily reverse string.

OUTPUT:

 

We can do this programming in another way too.

 

 

C Program To Reverse String


 #include<stdio.h>  
 #include<conio.h> 
#include<string.h>
int main()
{
 char string1[30];
 printf("n Enter string to reverse");
 printf("n Enter string:");
 gets(string1);
 strrev(string1);
 printf("n Reverse string in below:");
 printf("n %s",string1);
 getch();
}

OUTPUT:









SIMILAR POST:

C program to find the length of string.
C program to copy string.
C program to concatenation string.
String Function explanation .

Loading...

admin

One thought on “C program to reverse string / atozprogram

Leave a Reply

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