A utility function to do DFS for a 2D boolean matrix . It only considers the 8 neighbours as adjacent vertices
void DFS ( int M [ ] [ COL ] , int row , int col , bool visited [ ] [ COL ] , int & count ) {