-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentData.c
36 lines (32 loc) · 1018 Bytes
/
StudentData.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
#include "StudentData.h"
#include <string.h>
#include <stdio.h>
StudentData* SDCopy(StudentData* destination, const StudentData* source)
{
if(destination && source)
{
strcpy(destination->name, source->name);
strcpy(destination->index, source->index);
destination->bDay = source->bDay;
destination->bMonth = source->bMonth;
destination->bYear = source->bYear;
}
return destination;
}
bool SDIndexCompare(const char index[], const StudentData* student) /** true - equal, false - different / non-existent*/
{
if(student)
return strcmp(index, student->index) == 0;
return false;
}
bool SDNameCompare(const char name[], const StudentData* student) /** true - equal, false - different / non-existent*/
{
if(student)
return (strcmp(name, student->name) == 0);
return false;
}
void SDPrint(const StudentData* student)
{
if(student)
printf("%s %hhu-%hhu-%hu %s\n", student->name, student->bDay, student->bMonth, student->bYear, student->index);
}