字符串逆序

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <string.h>
 4 int main()
 5 {
 6     char *src="hello,world";
 7     char *dest,*d,*p;
 8     int len,i;
 9     len=strlen(src);
10     dest=(char *)malloc(len+1);
11     p=&src[len-1];
12     d=dest;
13     while(len--!=0)
14         *d++=*p--;
15         //*(d++)=*(p--);
16     *d='';
17     printf("%s",dest);
18     return 0;
19 }
原文地址:https://www.cnblogs.com/wydxry/p/12443945.html