diff --git a/a1/program.c b/a1/program.c index cf55ba9..7c7cc7d 100644 --- a/a1/program.c +++ b/a1/program.c @@ -29,12 +29,12 @@ int main() return 0; } -int reading_strings_and_storing_them_in_memory(link* pointer_to_start_of_chain){ +void reading_strings_and_storing_them_in_memory(link* pointer_to_start_of_chain){ link* next_link = pointer_to_start_of_chain; char buffer[SIZE]; link* ancestor=NULL; while(1){ - if(fgets(buffer, SIZE, stdin)==NULL){ + if(fgets(buffer, SIZE, stdin)==NULL||buffer[0]=='\n'){ if(ancestor!=NULL){ free(ancestor->p_na_next_struct); ancestor->p_na_next_struct=NULL;