I have a recursive function that returns an integer. On one compiler it returns the correct number; on another compiler it returns the wrong number. My function as the following setup:
Code:
int recurse_function(node* location)
{
if(true)
{
++num;
recurse_function(newlocation);
}
else if(true)
{
recurse_function(newlocation);
}
else
{
cout<<"the num before return: "<<num<<endl;
return num;
}
}
On both compilers the cout statement right before the return shows the correct number; yet on the second compiler -- and only on the second compiler -- it returns the wrong number. Any idea why? The second compiler is dev-C++...