Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>strrev() reverse characters in string</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
strrev()                 Reverse Characters in String

 #include   <string.h>                   Required for declarations only

 char       *strrev(string);
 char       *string;                     String to be reversed

    strrev() reverses the order of the characters in 'string'.  The
    terminating null character ('\0') remains at the end.

    Returns:    A pointer to the reversed string.  There is no error
                return.

  -------------------------------- Example ---------------------------------

    The following statements make a copy of 'string' (using strdup()),
    reverse the copy, then print out both the original and the copy.

         #include <string.h>
         #include <stdio.h>

         char string[27] = "abcdefghijklmnopqrstuvwxyz";
         char *rev;

         main()
         {
             rev = strrev(strdup(string));
             printf("original: %s\nreversal: %s\n",string,rev);
         }

See Also: strcpy() strset()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson