pvjc26/a3/program.c

55 lines
1.0 KiB
C

#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#DEFINE BUFFER_SIZE 64;
#DEFINE STUDENT_SIZE 32;
struct studentApplication
{
char meno[BUFFER_SIZE];
}
int main()
{
int studentsAmount;
struct studentsApplication student[STUDENT_SIZE];
int i = 0;
char processedName[BUFFER_SIZE];
setMemoryOfArrays(processedName, student);
while (fgets(line, SIZE, stdin) != NULL)
{
if (studentsAmount == 0)
{
if(sscanf(line, "%d", studentsAmount) == 1) { continue; }
}
else if(sscanf(line, "%s", processedName) == 1)
{
strcpy(student[i].meno, processedName);
i++;
}
}
if (studentsAmount == 0)
{
puts("Nespravny vstup");
return 0;
}
return 0;
}
void setMemoryOfArrays(char* processedName, studentsApplication* student)
{
//prednastavi pamat mnozinovych premien
processedName[0] = '\0';
for (int i = 0; i++; i < STUDENT_SIZE)
{
student[i].meno = '\0';
}
}