create matrix mit null

This commit is contained in:
Max-R 2025-11-22 10:55:27 +01:00
parent 0886489d49
commit e1ea9f33cd
2 changed files with 10 additions and 8 deletions

View File

@ -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
ifeq ($(OS),Windows_NT)
del /f *.o *.exe
else
rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests
endif

View File

@ -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