From 63d0ca3727a68e88edf29c6c3964a06793d5bdfc Mon Sep 17 00:00:00 2001 From: ak643du Date: Thu, 21 Mar 2024 17:21:02 +0100 Subject: [PATCH] Initialization --- cv5/program.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cv5/program.c b/cv5/program.c index b517c01..2f4dce4 100644 --- a/cv5/program.c +++ b/cv5/program.c @@ -43,10 +43,12 @@ int main() { // parse the string and extract number of votes and student name int votes; char name[SIZE]; + + // Attempt to parse the input line if (sscanf(line, "%d %[^\n]", &votes, name) != 2) { - // error, input was not in expected format - // print error message and exit - break; + // Error: Unable to parse input line + printf("Nepodarilo nacitat nic\n"); + return 1; // Exit with error code } // check if this student already exists @@ -78,4 +80,4 @@ int main() { } return 0; -} +} \ No newline at end of file