From e1ea9f33cd9ac7d4521cefe6fc6825732101d1ee Mon Sep 17 00:00:00 2001 From: Max-R Date: Sat, 22 Nov 2025 10:55:27 +0100 Subject: [PATCH] create matrix mit null --- makefile | 14 ++++++-------- matrix.c | 4 ++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/makefile b/makefile index 5d94684..444bd21 100644 --- a/makefile +++ b/makefile @@ -57,12 +57,10 @@ imageInputTests: imageInput.o imageInputTests.c $(unityfolder)/unity.c # -------------------------- # Clean # -------------------------- -#clean: -#ifeq ($(OS),Windows_NT) -# del /f *.o *.exe -#else -# rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests -#endif -# clean für windows clean: - rm -f *.o *.exe \ No newline at end of file +ifeq ($(OS),Windows_NT) + del /f *.o *.exe +else + rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests +endif + \ No newline at end of file diff --git a/matrix.c b/matrix.c index fb44123..da73deb 100644 --- a/matrix.c +++ b/matrix.c @@ -8,6 +8,10 @@ MatrixType *buffer; //Zeiger auf Speicherbereich Reihen*Spalten } Matrix;*/ Matrix createMatrix(unsigned int rows, unsigned int cols) { + if (cols == 0 || rows == 0){ + Matrix errorMatrix = {0, 0, NULL}; + return errorMatrix; + } MatrixType *buffer = malloc(rows * cols * sizeof(MatrixType)); // Speicher reservieren, malloc // liefert Zeiger auf Speicher