#include
#include
#include
void show_res(char *ch, int num){
int i;
for(i = 0; i < num; ++i)
if(ch[i] == 0)
printf("\\0 ");
else
printf("%c ", ch[i]);
printf("\n");
}
void rotate_shift_left_one(char *ch, int end){
char tmp = ch[0];
int i;
for(i = 1; i < end; ++i)
ch[i-1] = ch[i];
ch[end-1] = tmp;
}
int calc_end_pos(char *ch){
return strlen(ch);
}
void rotate_count(char *ch, int n){
int end_pos = calc_end_pos(ch);
int i;
for(i = 0; i < n; ++i)
rotate_shift_left_one(ch, end_pos);
}
int main(){
char str[100] = "abcdefg\0hi";
show_res(str, 10);
rotate_count(str, 2);
show_res(str, 10);
return 0;
}