|
|
|
|
|
by krapp
523 days ago
|
|
You have to allocate the size for m and n, because C arrays decay bare pointers. But it seems to work, which I didn't expect[0]. It also seems like you have to de-reference it to use it which is weird. [0]https://onlinegdb.com/HwX-WTL5t |
|
In your code link you over allocate memory, sizeof *arr is enough and you need to dereference like with (*arr)[i][j]. You need to dereference it because it is a pointer to an array, if you dereference you get an array. You can also let the first dimensions decay then it looks like:
but this is not as safe because the bound of the outermost dimension is lost. (Edited)