i want to allocate a matrix.
is this the only option:
int** mat = (int**)malloc(rows * sizeof(int*)) for (int index=0;index
You may also use calloc, which will additionally zero initialize the matrix for you. The signature is slightly different:
int *mat = (int *)calloc(rows * cols, sizeof(int));