问题:
把一个字符串的内容逆序输出
#include<stdio.h> #include<assert.h> #include<string.h> char * my_change(char*srt1,int k) { char *ret = srt1; char *start = srt1; char *end = srt1 + k - 1; char tmp; while (start < end) { tmp = *start; *start = *end; *end = tmp; start++; end--; } return ret; } int main(void) { char arr[10] = "abcdef"; int k = strlen(arr); printf("%s\n", my_change(arr,k)); system("pause"); }