fixed copy function
I mistook the variables inside the loop and it caused really weird behaviour
This commit is contained in:
parent
9929a4470c
commit
6ab823c1fc
5
matrix.c
5
matrix.c
@ -78,9 +78,8 @@ int read_csv(const char *file_name, const uint64_t row_length, const uint64_t co
|
|||||||
}
|
}
|
||||||
|
|
||||||
void copy(const uint64_t row_length, const uint64_t column_length, const uint64_t input_matrix[row_length][column_length], uint64_t output_matrix[row_length][column_length]) {
|
void copy(const uint64_t row_length, const uint64_t column_length, const uint64_t input_matrix[row_length][column_length], uint64_t output_matrix[row_length][column_length]) {
|
||||||
|
// loop should technically not be needed, but I cannot figure out the required size of __n.
|
||||||
for (uint64_t row_index = 0; row_index < row_length; row_index++) {
|
for (uint64_t row_index = 0; row_index < row_length; row_index++) {
|
||||||
for (uint64_t column_index = 0; column_index <column_length; column_index++) {
|
memcpy(output_matrix[row_index], input_matrix[row_index], sizeof(output_matrix[row_index]));
|
||||||
output_matrix[row_index][column_length] = input_matrix[row_index][column_index];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user