#include
#include
#include
float findAvg( size_t cols, float (*strip)[cols], size_t rows) {
float tot = 0.0;
for (int i = 1; i 0.0001) {
for (int i=1; i < rows-1; i++) {
for (int j=1; j < cols-1; j++) {
strip[i][j] = (strip[i-1][j] + strip[i+1][j] + strip[i][j-1] + strip[i][j+1])/4.0;
}
}
lastAvg = avg;
avg = findAvg(cols, strip, rows);
count++;
}
printf("average: %f, count: %d", avg, count);
} else { // go here if the malloc failed
printf("malloc error\n");
}
}