diff --git a/src/schach_in_ein_puzzle/PuzzleI.c b/src/schach_in_ein_puzzle/PuzzleI.c index d927864..8d6f5d8 100644 --- a/src/schach_in_ein_puzzle/PuzzleI.c +++ b/src/schach_in_ein_puzzle/PuzzleI.c @@ -59,4 +59,16 @@ void print_Puzzlebrett(char** Brett) { printf("\n"); } printf("\n"); +} + +void Puzzlebrettspeicher_freigeben(char** Brett) { + if (Brett == NULL) { + return; + } + + for (int i = 0; i < 8; i++) { + free(Brett[i]); + } + + free(Brett); } \ No newline at end of file diff --git a/src/schach_in_ein_puzzle/PuzzleI.h b/src/schach_in_ein_puzzle/PuzzleI.h index 867c5cd..112a9a2 100644 --- a/src/schach_in_ein_puzzle/PuzzleI.h +++ b/src/schach_in_ein_puzzle/PuzzleI.h @@ -5,5 +5,6 @@ char** Puzzlebrett_erstellen(); void print_Puzzlebrett(char** Brett); +void Puzzlebrettspeicher_freigeben(char** Brett); #endif // PUZZLEI_H \ No newline at end of file