Nevermind my previous post.
edit:
I slightly overlooked the test cases.
Nevermind my previous post.
edit:
I slightly overlooked the test cases.
Last edited by stevesmithx; 01-13-2009 at 09:14 AM.
Not everything that can be counted counts, and not everything that counts can be counted
- Albert Einstein.
No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
- Herbert Mayer
i put -1
on the index of that line
and i get the same error
and now the output is not correct
??
how to fix this out of band problem?
Which compiler are you using.
It compiles and runs fine under mingw port of gcc.
Not everything that can be counted counts, and not everything that counts can be counted
- Albert Einstein.
No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
- Herbert Mayer
You posted this program, and it looks like it should work:
Do you get any errors running the above program that you wrote? I merely adjusted the indentation and remove the superfluous 100 from the function parameter.Code:#include <stdio.h> int recFindMin(int array[], int index); int main() { int array[3] = {2, 1, 3}; printf("%d\n", recFindMin(array, 2)); return 0; } int recFindMin (int array[], int index) { int local; if (index == 0) { return array[index]; } local = recFindMin(array, index - 1); if (array[index] > local) { return local; } else { return array[index]; } }
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
thanks its working