Everything looks good until I see this:
int blockx, blocky;
for(blockx = 0; blockx < n; blockx+=n) {
for(blocky=0; blocky < n; blocky+=n) {
greyscale = ((array[x][y][0] + array[x][y][1] +array[x][y][2])/(3*(n*n)));
char c = method_of_conversion(greyscale);
fprintf(output,"%c",c); }
}
This code is the same as:
greyscale = ((array[x][y][0] + array[x][y][1] +array[x][y][2])/(3*(n*n)));
char c = method_of_conversion(greyscale);
fprintf(output,"%c",c);
This is because the for loop(s) can only execute once. You say you want to sum the RGB values inside a boxed area (eg. 3 x 3) but the loop above does not sum. You must read all the pixels into memory before they can be summed.
Try something like this:
int x, y;
for (x = 0; x < width; x++){
for(y=0; y < height; y++){
array[x][y][0] = fgetc(input); array[x][y][1] = fgetc(input); array[x][y][2] = fgetc(input); }
}
Now all the pixels are in memory. Your work can begin.
int greyscale;
int i, j, *pixel;
for (x = 0; x < width; x += n) {
for (y=0; y < height; y += n) {
greyscale = 0;
for (i = 0; i < n; i++) {
if (x + i >= width) break;
for (j = 0; j < n; j++) {
if (y + j >= height) break;
pixel = array[x + i][y + j];
greyscale += pixel[0] + pixel[1] + pixel[2]; }
}
greyscale /= 3*n*n;
char c = method_of_conversion(greyscale);
fprintf(output,"%c",c); }
fprintf(output,"\n");
}
The above code also handles the boundary condition(s) where width and height are not multiples of "n".