Kommentare angepasst
This commit is contained in:
parent
b998717e19
commit
54ca7acca2
7
matrix.c
7
matrix.c
@ -34,15 +34,16 @@ void clearMatrix(Matrix *matrix)
|
|||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
if (rowIdx < matrix.rows && colIdx < matrix.cols && matrix.buffer != NULL)
|
if (rowIdx < matrix.rows && colIdx < matrix.cols && matrix.buffer != NULL) //Prüft ob Zugriff möglich
|
||||||
matrix.buffer[rowIdx * matrix.cols + colIdx] = value; //gibt xxxxxxxxxx
|
matrix.buffer[rowIdx * matrix.cols + colIdx] = value;
|
||||||
|
//schreibt 2D element in 1D Liste: Element_Reihe*Matrix_Spalten + Element_Spalte
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
if (rowIdx >= matrix.rows || colIdx >= matrix.cols || matrix.buffer == NULL)
|
if (rowIdx >= matrix.rows || colIdx >= matrix.cols || matrix.buffer == NULL)
|
||||||
return 0; // Sicherheitscheck
|
return 0; // Sicherheitscheck
|
||||||
return matrix.buffer[rowIdx * matrix.cols + colIdx]; //xxxxxxxxxxxx
|
return matrix.buffer[rowIdx * matrix.cols + colIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Funktionen implementieren
|
// TODO: Funktionen implementieren
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user