void reverse(char *str1, char *str2)
{
char temp = 0;
temp = *str1;
*str1 = *str2;
*str2 = temp;
}
void reverseString(char* s, int sSize)
{
int i = 0;
int j = sSize - 1;
while(i < j)
{
reverse(&s[i], &s[j]);
i++;
j--;
}
}
力扣-344. 反转字符串
最新推荐文章于 2024-08-25 17:36:33 发布