Skip to content
Snippets Groups Projects
Commit 72780f3c authored by expan's avatar expan
Browse files

fix seg)

parent e470752a
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ cons_cell* parse(char* input, int size) {
return create_cons_cell(car_cons, cdr_cons);
} else {
int first_space_idx = 0;
while (input[first_space_idx] != " ")
while (input[first_space_idx] != " " && input[first_space_idx] != NULL)
first_space_idx++;
char buff_first[500];
......@@ -39,7 +39,7 @@ cons_cell* parse(char* input, int size) {
next_char++;
}
strncpy(buff_other, input[next_char], size - next_char);
strncpy(buff_other, &input[next_char], size - next_char);
cons_cell* cdr_cons = parse(buff_other, size-next_char);
car_cons->cdr = cdr_cons;
return car_cons;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment