by krapp · 1y ago · 0 comments
Source: https://stackoverflow.com/questions/36647286/are-c-multidime...
Although at least with 2d arrays I prefer to just use a 1d array and index it with [x * width + y], because one problem with multidimensional arrays in C is they need multiple allocations/frees.
edit: Isn't it just:
float (*arr)[m][n] = malloc(sizeof(*arr));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.