Solved
function procedure design
Posted on 2006-11-12
hi,
I have a program like below:
the problem is the backtrack() will return me more than one set of (newt[N][i][j] != 0), but only first set goes to addpath(N, i, j). how can I let the program run every set of (newt[N][i][j] != 0)?
---------------------------------------
main ()
{
backtrack();
system("pause");
return 0;
}
void backtrack(void)
{
for (i=0; i<3;i++){
for (j=0; j<3; j++) {
if (newt[N][i][j] != 0)
{
addpath(N, i, j);
}//end if
}// 3rd for
} // 2nd for
}
----------------------------------------------------------------------------
<ps> the addpath(N, i, j) will continue call other functions.....but I am sure that the final function is looks like
void addpath (int s, int i, int j)
{
if( s == 0 )
{
printf("final path is %d%d%d : \n",s,i,j);
printf("finish!!\n");-------------------------------------------->> end here
return;
}
call other functions....
}