Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

reverse the string without using any inbuilt functions

 // reverse the string without using any inbuilt functions


#include <stdio.h>


int main()

{

    int i,count=0; int j=0;

    char str[10];

    char rev[10];

    

    printf("enter the string\n");

    scanf("%s",str);

    

    while ( str[count] != '\0')

    {

        count++;

    }

    

    for ( i=count-1 ; i >=0 ; i--)

    {

        rev[j++]=str[i];

    }

    

    rev[j]='\0';

    

    printf("reverse of %s is %s\n",str,rev);

    

    

}

Post a Comment

0 Comments