#include <stdio.h>
#define MAXS 20
void reverse( char *p );
void reverse( char *p )
{
int i = 0, q = 0, h, tmp;
while (p[i] != ‘\0‘)
i++;
h = i - 1;
while (q <= h)
{
tmp = p[q];
p[q] = p[h];
p[h] = tmp;
q++;
h--;
}
return ;
}
int main()
{
char str[MAXS]="hello";
//ReadString(s);
reverse(str);
printf("%s\n", str);
return 0;
}
原文:https://www.cnblogs.com/CodeWorkerLiMing/p/11627276.html