Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int* mat_find(Mat* mat, int value, int* n){
- int** matrix = mat->row_ptrs;
- int rows = mat->rows;
- int cols = mat->cols;
- int cont = 0, k = 0;
- for (int i=0; i<rows; i++){
- for (int j=0; j<cols; j++){
- if (matrix[i][j]>value) {
- cont=cont+1;
- }
- }
- }
- *n = cont;
- int* vect = (int*)malloc(cont*sizeof(int));
- for (int i=0; i<rows; i++){
- for (int j=0; j<cols;j++){
- if (matrix[i][j]>value){
- vect[k++]=i*cols+j;
- }
- }
- }
- return vect;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement