原型:extern char *strrev(char *s);
用法:#include <string.h>
功能:把字符串s的所有字符的顺序颠倒过来(不包括空字符NULL)。
说明:返回指向颠倒顺序后的字符串指针。
举例:
// strrev.c
#include <syslib.h>
#include <string.h>
main()
{
char *s="Welcome To Beijing";
clrscr();
textmode(0x00); // 6 lines per screen
printf("%s
%s",s,strrev(strdup(s)));
getchar();
return 0;
}
strrev(PHP 4, PHP 5)
strrev — Reverse a string
说明
stringstrrev( string $string )
Returnsstring, reversed.
参数
stringThe string to be reversed.
返回值
Returns the reversed string.
范例
Example#1 Reversing a string with strrev()
strrev("Hello world!"); // outputs "!dlrow olleH"