Add module for structs.

This commit is contained in:
paulusja committed 2026-10-29 11:15:37 +01:00
1 parent 45336b083c
commit a385f4d623
2 files changed
+118

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#ifndef NAMEARCHIVE_H
#define NAMEARCHIVE_H
// Maximale Namenslänge
#define MAX_NAME_LEN 10
// Maximale Anzahl an Namen
#define MAX_PERSONS 100
typedef struct
{
char name[MAX_NAME_LEN];
unsigned int age;
} Person;
// Fügt einen Namen 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 removeName(const Person person);
void sortPersons();
// Gibt die Namen zeilenweise aus.
void printPersons();
#endif