/*
* 对char数组从start到end位置进行翻转
*/
void reverse(char[] str,int start,int end){
char temp;
while(start<end){
temp = str[start];
str[start++] = str[end];
str[end--] = temp;
}
}
对数组进行指定位置的翻转
最新推荐文章于 2022-11-18 10:50:18 发布
/*
* 对char数组从start到end位置进行翻转
*/
void reverse(char[] str,int start,int end){
char temp;
while(start<end){
temp = str[start];
str[start++] = str[end];
str[end--] = temp;
}
}