#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//字符串反转
void main()
{
char p[] = "abcde";
printf("反转之前:");
puts(p);
printf("\n");
char c;
char *p1 = p;
char *p2 = p + strlen(p) - 1;
while(p1 < p2)
{
c = *p1;
*p1 = *p2;
*p2 = c;
++p1;
--p2;
}
printf("反转之后:");
puts(p);
printf("\n");
system("pause");
}
转载于:https://my.oschina.net/startstorm/blog/508267