I'm having a pretty weird logic error. It seems that this code is always ending my arrays with 3. It should (being a recursive function) iterate through 0, 1, 2, 3. My test array is of length 4 but I am completely missing the reason. Can anyone else see the error?
work(array, where)
{
if(where <= array.length - 1)
{
for(int i = 0; i <= array.length - 1; i++)
{
array[where] = i;
work(array, where + 1);
}
}
}
NOTE: Where is initially 0