Dynamic allocation (easy way)
There are multiple ways to dynamically allocate a matrix
Here, we'll walk through the easiest - treat a 2D array as a 1D array!
int* mat = (int*)malloc(w * h * sizeof(int));
How to access the c-th column of the r-th row?
This is a cross-language way to handle multi-dimensional arrays
- Can’t use
[][] notation, though