Function rc_matrix_zeros#

Function Documentation#

int rc_matrix_zeros(rc_matrix_t *A, int rows, int cols)#

Resizes matrix A and allocates memory for a matrix with specified rows & columns. The new memory is pre-filled with zeros using calloc. Any existing memory allocated for A is freed if necessary to avoid memory leaks.

Parameters:
  • A – Pointer to user’s matrix struct

  • rows[in] number of rows

  • cols[in] number of columns

Returns:

0 on success, -1 on failure.