Answer the question
In order to leave comments, you need to log in
How to fill in a structure in SI?
struct student {
char name[64];
int marks[5];
};
struct Group {
struct student* stud;
int size;
int id;
};
struct Faculty {
struct Group* groups;
int size;
char faculty[100];
};
struct University {
struct Faculty* faculties;
int size;
char univer[100];
};
int main() {
struct University* unik = (struct University*)malloc(sizeof(struct University));
unik->size = 3;
unik->faculties = (struct Faculty*)malloc(unik->size * sizeof(struct Faculty));
unik->faculties->groups = (struct Group*)malloc(2 * sizeof(struct Group));
unik->faculties->groups->elements = (struct student*)malloc(5 * sizeof(struct student));
printf("University name ");
scanf_s("%s", unik->univer, 99);
...
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question