Quote Originally Posted by Sorinx View Post
Yeah I forgot to set the static 2 to 2 again in the function. I fixed that. Still not giving me the correct numbers not sure what's wrong.
Your understanding of recursion is wrong. All these nested functions calls will finally return back to where you started and thus numPrime() will return 1 to main() for every odd number and 0 for every even number.

I think you have forgotten that all these function calls return to the caller and not directly to main().

Bye, Andreas