, - malloc:)
typedef struct{
student *studs;
int studCtr;
}studList;
. , , → .
, , ,
student studs[10];
10 , addStudToFile() , . , , :
myStud.studs = (student *) malloc( sizeof(student) * how_many );
, , , , .
edit: malloc(), addStudToFile() - ,
free(myStud.studs);
...
, , fwrite() , , malloc() . sizeof (studlist) , . , , .
, , () studCtr, , malloced .
displayStudsFromFile(), , ,
student myStud;
.. , . fread() studCtr , fread() - myStud. :
printf("borrowed %d books", myStud.bksCtr);
, ... C : D