#include “stdio.h”
#include “stdlib.h”
#include “string.h”
void main()
{
char str[]=“hello,world”;//char str=“hello,world”;
chardest=NULL;
char*s,*d;
int len=strlen(str);
s=&str[len-1]; //指向最后一字符,即d 或者s=str+len-1(因为指针指向字符串时,只给了字符串的首地址)
dest=(char*)malloc(len+1);
d=dest;
while(len–!=-1)
*d++=*s–;
d=’\0’; //字符串结尾
printf("%s\n",dest);
}