#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
void reverse(char *str)
{
char len = 0;
char *p_top, *p_end;
char temp;
assert(str != NULL);
len = strlen(str);
p_top = str;
p_end = str + len - 1;
while(p_top < p_end)
{
temp = *p_top;
*p_top = *p_end;
*p_end = temp;
p_top++;
p_end--;
}
}
int main(void)
{
char str[] = "ABCD1234efgh";
reverse(str);
printf("%s\n",str);
}
C语言笔试题(1)——将字符串对调显示
