-
Notifications
You must be signed in to change notification settings - Fork 0
/
List.c
48 lines (40 loc) · 820 Bytes
/
List.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
#include "List.h"
#include <stdio.h>
#include <stdlib.h>
Student* Add(const StudentData* studentData, Student** listHead)
{
Student* newStudent = (Student*)malloc(sizeof(Student));
if(newStudent)
{
SDCopy(&(newStudent->studentData), studentData);
if(!(*listHead))
{
newStudent->next = NULL;
(*listHead) = newStudent;
}
else
{
newStudent->next = (*listHead)->next;
(*listHead)->next = newStudent;
}
}
return newStudent;
}
void DeleteList(Student** listHead)
{
while(*listHead)
{
Student* temp = *listHead;
*listHead = (*listHead)->next;
free(temp);
}
}
void Remove(const char index[], Student** listHead)
{
}
void FindIndex(const char index[], Student** listHead)
{
}
void FindName(const char name[], Student** listHead)
{
}