0
1.8kviews
Write a program to find reverse of given string without using string library function.
1 Answer
0
68views
#include<stdio.h>
#include<conio.h>

void main()
{
char str[50];
char rev[50];
int i=0,j=0;

    printf("Enter any string to be reversed : ");
    scanf("%s",str);

    while(str[i]!='\0')
   {
    i++;
   }
    i--;
    while(i>=0)
    {
     rev[j] = str[i];
     j++;
     i--;
    }
    rev[j]='\0';
    printf("Reverse of string is : %s",rev);

    getch();
}
Please log in to add an answer.