reverse a string
#include <string.h> char *strrev( char *s1 ); char *_strrev( char *s1 ); char __far *_fstrrev( char __far *s1 );
The strrev() function replaces the string s1 with a string whose characters are in the reverse order.
The _strrev() function is identical to strrev(). Use _strrev() for ANSI/ISO naming conventions.
The _fstrrev() function is a data-model-independent form of the strrev() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.
The address of the original string s1.
#include <stdio.h>
#include <string.h>
char source[] = { "A sample STRING" };
void main()
{
printf( "%s\n", source );
printf( "%s\n", strrev( source ) );
printf( "%s\n", strrev( source ) );
}
produces the output:
A sample STRING GNIRTS elpmas A A sample STRING
WATCOM
_strrev() conforms to ANSI/ISO naming conventions.
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |