int* luckyNumbers (int** matrix, int matrixSize, int* matrixColSize, int* returnSize){ int i,j,k,count=0,min,col,pst=0; int* retArr = (int*)malloc(sizeof(int)); for (i=0; i<matrixSize; i++) { min = 100001; for (j=0; j<matrixColSize[i]; j++) { if (matrix[i][j] < min) { min = matrix[i][j]; col = j; } } for (k=0; k<matrixSize; k++) { if (k == i) continue; if (matrix[k][col] > min) break; } if (k == matrixSize) retArr[pst++]=min;; } *returnSize=pst; return retArr; }