pages

Friday, 30 April 2021

c-program to reverse the string without using strrev function | c-programming

 program to reverse of the number without using strrev function 

In this program ,we will takes input as a string by the user and reverse the string  without using strrev  function .


#include<stdio.h>
#include<conio.h>
void main()
{
   char str[20],temp;
   int i,l;
   printf("enter the string:-");
   gets(str);
   for(l=0;l<=str[l];l++);
   for(i=0;i<l/2;i++){
         temp=str[i];
         str[i]=str[l-i-1];
         str[l-i-1]=temp;
   }
   printf("\n the reverse of the string is %s:-",str);
   getch();
}

output:-


For more c-programming:-













No comments:

Post a Comment