Aktualizovat a3/program.c

This commit is contained in:
Tomáš Vlček 2026-03-30 07:58:07 +00:00
parent 8e19c7fbab
commit b201e9a3e8

View File

@ -32,8 +32,8 @@ int main()
} }
else if(sscanf(line, "%s", &processedName) == 1) else if(sscanf(line, "%s", &processedName) == 1)
{ {
strcpy(student[i].meno, processedName); strcpy(student[i].name, processedName);
strncat(student[i].meno, &newLineSymbol, 1); strncat(student[i].name, &newLineSymbol, 1);
i++; i++;
} }
} }
@ -50,13 +50,13 @@ int main()
for (int i = 0; i < studentsAmount; i++) for (int i = 0; i < studentsAmount; i++)
{ {
puts("Prijati studenti:"); puts("Prijati studenti:");
puts(student[i].meno); puts(student[i].name);
} }
for (int i = studentsAmount; student[i].meno[0] != '\0'; i++) for (int i = studentsAmount; student[i].meno[0] != '\0'; i++)
{ {
puts("Neprijati studenti:"); puts("Neprijati studenti:");
puts(student[i].meno); puts(student[i].name);
} }
return 0; return 0;
@ -69,7 +69,7 @@ void setMemoryOfArrays(char* processedName, studentsApplication* student)
for (int i = 0; i < STUDENT_SIZE; i++) for (int i = 0; i < STUDENT_SIZE; i++)
{ {
student[i].meno[0] = '\0'; student[i].name[0] = '\0';
} }
} }