Computer Science, asked by deepakkumar5695, 1 year ago

a program in c to convert a string in revers order to another string.

Answers

Answered by kvnmurty
0
#define <stdio.h>
#define MAX 128

main ()
{
      int myString[MAX] ;   // given string
      int myString2[MAX]; // reversed string
      int  k, j ;   // indices into the above character arrays

         printf("\n Input the string: ");
         scanf("%s",&myString[0]);
         
         for (k=0;  myString[k] != '\0'  ; k++) // reach the end of string
                       ;
         k--; // points to the last char in the string
         for (j =0;  k >= 0 ; k--, j++)   // copy chars till the start
                myString2[j] = myString[k];
         myString2[j] = '\0' ;

}


kvnmurty: click on thank you link
Similar questions