Correct/add comments.
This commit is contained in:
1 parent
8f1a6e24a7
commit
ac18579fea
2 files changed
+6
-6
No files matched your search
@@ -74,13 +74,11 @@ int comparePersons(const void *arg1, const void *arg2)
|
|||||||
return nameResult;
|
return nameResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sortiert die Namen im Archiv aufsteigend.
|
|
||||||
void sortPersons()
|
void sortPersons()
|
||||||
{
|
{
|
||||||
qsort(persons, numberOfPersons, sizeof(persons[0]), comparePersons);
|
qsort(persons, numberOfPersons, sizeof(persons[0]), comparePersons);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gibt die Namen zeilenweise aus.
|
|
||||||
void printPersons()
|
void printPersons()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < numberOfPersons; i++)
|
for(int i = 0; i < numberOfPersons; i++)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
// Maximale Namenslänge
|
// Maximale Namenslänge
|
||||||
#define MAX_NAME_LEN 10
|
#define MAX_NAME_LEN 10
|
||||||
|
|
||||||
// Maximale Anzahl an Namen
|
// Maximale Anzahl an Personen
|
||||||
#define MAX_PERSONS 100
|
#define MAX_PERSONS 100
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -13,14 +13,16 @@ typedef struct
|
|||||||
unsigned int age;
|
unsigned int age;
|
||||||
} Person;
|
} Person;
|
||||||
|
|
||||||
// Fügt einen Namen hinzu. Im Fehlerfall (Archiv ist voll) soll 0, ansonsten 1 zurückgegeben werden.
|
// Fügt eine Person hinzu. Im Fehlerfall (Archiv ist voll) soll 0, ansonsten 1 zurückgegeben werden.
|
||||||
// Ist der angegebene Name länger als die zulässige Namenslänge, wird der Name abgeschnitten hinzugefügt. Rückgabe ist dann 1.
|
|
||||||
int addPerson(const Person person);
|
int addPerson(const Person person);
|
||||||
|
|
||||||
|
// Entfernt Person aus Archiv. Gibt 1 zurück bei Erfolg und 0 ansonsten (Person nicht gefunden).
|
||||||
int removePerson(const Person person);
|
int removePerson(const Person person);
|
||||||
|
|
||||||
|
// Sortiert das Archiv nach Personen (aufsteigend nach Namen, dann nach Alter)
|
||||||
void sortPersons();
|
void sortPersons();
|
||||||
// Gibt die Namen zeilenweise aus.
|
|
||||||
|
// Gibt Personen zeilenweise aus.
|
||||||
void printPersons();
|
void printPersons();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user