#include<stdio.h>
void reverse(char *str, int len){
if(len==0||str=="")
return;
int i;
char t;
for(i=0; i<len/2; i++){
t = str[i];
str[i] = str[len-i-1];
str[len-i-1] = t;
}
}
void main(){
char str[8]= "abcdefg";
reverse(str,3);
reverse(str+3,7-3);
reverse(str,7);
printf("reverse string result is %s\n",str);
}
void reverse(char *str, int len){
if(len==0||str=="")
return;
int i;
char t;
for(i=0; i<len/2; i++){
t = str[i];
str[i] = str[len-i-1];
str[len-i-1] = t;
}
}
void main(){
char str[8]= "abcdefg";
reverse(str,3);
reverse(str+3,7-3);
reverse(str,7);
printf("reverse string result is %s\n",str);
}