Initialization
This commit is contained in:
parent
c12528480b
commit
63d0ca3727
@ -43,10 +43,12 @@ int main() {
|
|||||||
// parse the string and extract number of votes and student name
|
// parse the string and extract number of votes and student name
|
||||||
int votes;
|
int votes;
|
||||||
char name[SIZE];
|
char name[SIZE];
|
||||||
|
|
||||||
|
// Attempt to parse the input line
|
||||||
if (sscanf(line, "%d %[^\n]", &votes, name) != 2) {
|
if (sscanf(line, "%d %[^\n]", &votes, name) != 2) {
|
||||||
// error, input was not in expected format
|
// Error: Unable to parse input line
|
||||||
// print error message and exit
|
printf("Nepodarilo nacitat nic\n");
|
||||||
break;
|
return 1; // Exit with error code
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if this student already exists
|
// check if this student already exists
|
||||||
@ -78,4 +80,4 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user