I am trying to search aa 2 dimensional array for all combinations
and am having trouble with my bool array of has been there. I tried to have my bool array global but I didn't get all combos. I tried carrying it with me on every recursive call and didn't get every combo. My project is eventually to get all words out of a 2dimensional array of characters, but I have been testing my recusive search with a 2x2 array of ints, just to try to get it to work. Here is my code>>>
include<iostream>

using namespace std;

enum visits{nv,v};

void CleartheGrid(visits[2][2]);

void Traverse(int[2][2],int,int,int[16],int,visits[2][2]);

int main()
{
int graph[2][2];
int num[16];
int col;
int row;
int len=0;
visits visited[2][2];


for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
{
cin>>graph[i][j];

}
for(row=0;row<2;row++)
for(col=0;col<2;col++)
{
CleartheGrid(visited);
len=0;
Traverse(graph,row,col,num,len,visited);

}
return 0;
}

/************************************************** *****************/
void Traverse(int graph[2][2], int row, int col, int num[], int len,
visits visited[2][2])

{

if(row < 0 || row >1 || col < 0 || col > 1)
return;
if(visited[row][col]==v)
return;

num[len]=graph[row][col];
len++;
visited[row][col]=v;


Traverse(graph,row-1,col,num,len,visited);
Traverse(graph,row-1,col+1,num,len,visited);
Traverse(graph,row,col+1,num,len,visited);
Traverse(graph,row+1,col+1,num,len,visited);
Traverse(graph,row+1,col,num,len,visited);
Traverse(graph,row+1,col-1,num,len,visited);
Traverse(graph,row,col-1,num,len,visited);
Traverse(graph,row,col-1,num,len,visited);

for(int n=0;n<len;n++) cout<<num[n]<<" ";
cout<<endl;


}
/************************************************** **********************/
void CleartheGrid(visits visited[2][2])
{

for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
visited[i][j]=nv;