作者:竹叶清2012 | 来源:互联网 | 2023-10-17 08:55
问题:
把一个字符串的内容逆序输出
#include
#include
#include
char * my_change(char*srt1,int k)
{
char *ret = srt1;
char *start = srt1;
char *end = srt1 + k - 1;
char tmp;
while (start {
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");
}