RAD Studio |  |

strrev, _mbsrev, _wcsrev

Header File

string.h, mbstring.h

Category

Memory and String Manipulation Routines

Prototype

char *strrev(char *s);

wchar_t *_wcsrev(wchar_t *s);

unsigned char *_mbsrev(unsigned char *s);

Description

Reverses a string.

strrev changes all characters in a string to reverse order, except the terminating null character. (For example, it would change string\0 to gnirts\0.)

Return Value

strrev returns a pointer to the reversed string.

Example

Copy Code

    #include <string.h>
    #include <stdio.h>
    int main(void)
    {
       char *forward = "string";
       printf("Before strrev(): %s\n", forward);
       strrev(forward);
       printf("After strrev():  %s\n", forward);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
strrev |  | + |  |
_mbsrev |  | + |  |
_wcsrev |  | + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!