void arr_print(char* ret)
{
assert(ret);
char* left = ret;
char* right = ret + strlen(ret) - 1;
while (left<right)//以中心点向两边头互换内容
{
char temp = *left;
*left = *right;
*right = temp;
left++;
right--;
}
}
int main()
{
char arr[] = "nowcoder";
arr_print(arr);
printf("%s", arr);
return 0;
}
字符串逆序
最新推荐文章于 2024-11-05 01:41:28 发布