Set pointers on Dynamic Matrix
问题 I'm trying to make a dynamic size matrix of 1-byte elements. To do so I defined the following function. The problem comes when I try to set the first "nrows" elements of the matrix to point the corresponding row (so I can do matrix[i][j]). It looks like that matrix[i] = matrix[nrows + i * single_row_elements_bytes]; doesn't work well enough (the program compiles but throws an core-segment-violation error). How can I make this work? uint8_t **NewMatrix(unsigned nrows, unsigned ncols) { uint8_t