#include #include #include char ** split(char *starting_string, size_t *length){ size_t spaces = 0; for(char *i = starting_string; *i; i++) if(*i == ' ') spaces++; char **return_value = malloc(sizeof(char*) * (spaces + 1)); return_value[0] = starting_string; size_t word = 1; for(char *i = starting_string; *i; i++) if(*i == ' '){ while(*(i+1) == ' '){ *i = 0; i++; } return_value[word++] = i + 1; *i = 0; } return_value[word] = 0; *length = spaces; return return_value; } void move_right(char *start, int distance){ size_t length = strlen(start); for(size_t i = length + distance; i > distance; i--) start[i] = start[i - distance]; } void move_left(char *start, int distance){ while(*start){ *(start - distance) = *start; start++; } *(start - distance) = 0; }