#include <stdio.h>
#include<string.h>
void fun(char *w,int n )
{
char t,*s1,*s2;
s1=w;
s2=w+n-1;
while(s1<s2)
{
t=*s1++;
*s1=*s2--;
*s2=t;
}
}
int main()
{
char p[] = "1234567";
fun(p,strlen(p));
puts(p);
return 0;
}
用来颠倒字符串,一开始S1与S2指向字符串的首尾,交换两个字符后,S1向后移一位,S2向前移一位直到最中间结束