Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int** findAvg(int** matrix, int avg, int lines, int columns){
- int **endLines = matrix + lines -1; //указатель на последнюю строку матрицы
- int *endColumns;
- while(matrix){
- *endColumns = *matrix + columns -1; //указатель на последний элемент строки
- while(*matrix){
- if((**matrix) == avg) return matrix;
- if(*matrix == endColumns) break; //защита от переполнения строки
- (*matrix)++;
- }
- if(matrix == endLines) break; //защита от переполнения матрицы
- matrix++;
- }
- return NULL;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement