how to malloc for matrix in c

Solutions on MaxInterview for how to malloc for matrix in c by the best coders in the world

showing results for - "how to malloc for matrix in c"
Léopold
11 Jun 2017
1int** mat = (int**)malloc(rows * sizeof(int*))
2
3for (int index=0;index<row;++index)
4{
5    mat[index] = (int*)malloc(col * sizeof(int));
6}
7