From 0fa7d5d8f7a8aa063a04dc76d5c6772adc32d510 Mon Sep 17 00:00:00 2001 From: kr820js Date: Sat, 23 Mar 2024 18:21:21 +0100 Subject: [PATCH] submition2 --- a1/program.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;