_strrev, _wcsrev, _mbsrev
Reverse characters of a string.
char *_strrev( char *string );
wchar_t *_wcsrev( wchar_t *string );
unsigned char *_mbsrev( unsigned char *string );
Routine Required Header Compatibility
_strrev Win 95, Win NT
_wcsrev or Win 95, Win NT
_mbsrev Win 95, Win NT
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
Each of these functions returns a pointer to the altered string. No return value is reserved to indicate an error.
Parameter
string
Null-terminated string to reverse
Remarks
The _strrev function reverses the order of the characters in string. The terminating null character remains in place. _wcsrev and _mbsrev are wide-character and multibyte-character versions of _strrev. The arguments and return value of _wcsrev are wide-character strings; those of _mbsrev are multibyte-character strings. For _mbsrev, the order of bytes in each multibyte character in string is not changed. These three functions behave identically otherwise.
Security Note These functions incur a potential threat brought about by a buffer overrun problem. Buffer overrun problems are a frequent method of system attack, resulting in an unwarranted elevation of privilege. For more information, see Avoiding Buffer Overruns.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tcsrev _strrev _mbsrev _wcsrev
Example
/* STRREV.C: This program checks an input string to
* see whether it is a palindrome: that is, whether
* it reads the same forward and backward.
*/
#include <string.h>
#include <stdio.h>
void main( void )
{
char string[100];
int result;
printf( "Input a string and I will tell you if it is a palindrome:\n" );
gets( string );
/* Reverse string and compare (ignore case): */
result = _stricmp( string, _strrev( _strdup( string ) ) );
if( result == 0 )
printf( "The string \"%s\" is a palindrome\n\n", string );
else
printf( "The string \"%s\" is not a palindrome\n\n", string );
}
Output
Input a string and I will tell you if it is a palindrome:
Able was I ere I saw Elba
The string "Able was I ere I saw Elba" is a palindrome if u want something else .. i will attach masteringstring.cpp ...