*reverse given strings.

 #include <stdio.h>


void xstrrev(char str[50])

    int l, j=0;

    l=strlen(str);

    char rev[50];

    for(int i=l-1;i>=0;i--)

     {rev[j]=str[i];

     j++;}

     strcpy(str, rev);

     printf("%s\n", str);

}


int main()

{

   char *s[ ] = {

"To err is human...",

"But to really mess things up...",

"One needs to know C!!"

} ;

for(int i=0;i<3;i++)

    xstrrev(s[i]);

}

    return 0;

}

Comments