Code:

#include <stdlib.h>
#include <stdio.h>
#define N 5
int blob_check(int pic[N][N], int x, int y)
{
if (pic[x][y] == 0)
return 0;
else
{
pic[x][y] = 0;
int sum = 1;
//check
if (x>0)
{
sum += blob_check(pic, x-1, y);
if (y<N-1)
sum += blob_check(pic, x-1, y+1);
}
else if (y<N-1)
{
sum += blob_check(pic, x, y+1);
if (x<N-1)
sum += blob_check(pic, x+1, y+1);
}
else if (x<N-1)
{
sum += blob_check(pic, x+1, y);
if (y>0)
sum += blob_check(pic, x+1, y-1);
}
else if (y>0)
{
sum += blob_check(pic, x, y-1);
if (x>0)
sum += blob_check(pic, x-1, y-1);
}
return sum;
}
}
int main()
{
int x,y,i,j;
int row=0;
char line[80];
int table[N][N] = { {1,1,0,0,0},
{0,1,1,0,0},
{0,0,1,0,1},
{1,0,0,0,1},
{0,1,0,1,1}};
printf("\t0\t1\t2\t3\t4\t");
printf("\n -----------------------------------------");
for(i=0;i<5;i++)
{
printf("\n |\n%d |\t", i);
for(j=0;j<5;j++)
{
printf("%d\t", table[i][j]);
}
}
printf("\n\nEnter x-y coordinates of cell => ");
scanf("%d %d", &y, &x);
printf("Pixel quantity in blob: %i\n", blob_check(table, x, y));
system("pause");
return 0;
}