Guest User

Untitled

a guest
Nov 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. char **args = NULL;
  2. args = malloc(sizeof(char *) * LINE_LENGTH);
  3.  
  4. bool parse_line(char *line, char **arr) {
  5. size_t i = 0;
  6. char *point;
  7. point = strtok(line, " ");
  8. while (point != NULL) {
  9. arr[i] = malloc(strlen(point) + 1);
  10. strcpy(arr[i], point);
  11. point = strtok(NULL, " ");
  12. i++;
  13. }
  14. arr[i] = NULL;
  15.  
  16. if (!arr)
  17. return false;
  18. return true;
  19. }
Add Comment
Please, Sign In to add comment