Directory: | ./ |
---|---|
File: | s21_create_matrix.c |
Date: | 2025-08-15 23:01:21 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 9 | 9 | 100.0% |
Branches: | 8 | 8 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "s21_matrix.h" | ||
2 | |||
3 | 414 | int s21_create_matrix(int rows, int columns, matrix_t *result) { | |
4 |
6/6✓ Branch 0 taken 410 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 406 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 404 times.
|
414 | if (rows <= 0 || columns <= 0 || result == NULL) { |
5 | 10 | return ERROR; | |
6 | } | ||
7 | |||
8 | 404 | result->columns = columns; | |
9 | 404 | result->rows = rows; | |
10 | |||
11 | 404 | result->matrix = (double **)calloc(rows, sizeof(double *)); | |
12 |
2/2✓ Branch 0 taken 1174 times.
✓ Branch 1 taken 404 times.
|
1578 | for (int i = 0; i < rows; i++) { |
13 | 1174 | result->matrix[i] = (double *)calloc(columns, sizeof(double)); | |
14 | } | ||
15 | |||
16 | 404 | return OK; | |
17 | } | ||
18 |