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);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster