自己动手实现字符串倒叙

 1 #include <stdio.h>
 2 //将字符串s倒叙
 3 void strrev(char *s)
 4 {
 5     char *p=s,t;
 6     if(*p)
 7         while(p[1])
 8             p++;
 9     while(s<p)
10     {
11         t=*s;
12         *s++=*p;
13         *p--=t;
14     }
15 
16 }
17 void main ()
18 {
19     char s[]="abcdef";
20     strrev(s);
21     puts(s);
22 }
23 
24 

原文地址:https://www.cnblogs.com/dzqdzq/p/3208728.html