-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-structs.c
67 lines (48 loc) · 969 Bytes
/
all-structs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "lib/all-structs.h"
#include <stdlib.h>
#include <stdio.h>
void initialize_Parent(Parent *parent)
{
}
void initialize_Grade(Grade *grade)
{
}
void initialize_Instructor(Instructor *instructor)
{
instructor=(Instructor*)calloc(1,sizeof(Instructor));
}
void initialize_Subject(Subject *subject)
{
}
void initialize_Student(Student *student)
{
student->gpa=-1.0; //Unknown
}
void uninitialize_Instructor(Instructor *instructor)
{
}
void uninitialize_Grade(Grade *grade)
{
}
void uninitialize_Subject(Subject *subject)
{
}
void uninitialize_Parent(Parent *parent)
{
}
void uninitialize_Student(Student *student)
{
free(student);
}
void push_back(Student **students,Student *student,int *size)
{
//adding memory to our dynamical array
(*students)[(*size)-1]=*student;
*students = (Student*)realloc(*students,((*size)+1)*(sizeof(Student)));
(*size)++;
if(students==NULL)
{
printf("Failed reallocation\n");
exit(0);
}
}