hello ,i need some help with free memory
my allocation:
(pixel is struct of RGB)
Code:pixel** array(int Y, int X) { pixel** theArray; theArray = (pixel**)malloc(Y * sizeof(pixel*)); for (int i = 0; i < Y; i++) { theArray[i] = (pixel*)malloc(X * sizeof(pixel)); } return theArray;what am i doing wrong ?Code:void freeMatrix(pixel ** pmatrix, size_t rows){ for (int i = 0; i < rows; ++i) { free((pmatrix)[i]);\\problem is here } free(pmatrix); pmatrix = NULL; }