Code:

bool checkprime(int kv,int nv) {
if(nv ==2 || kv<=2)
return true;
if(nv%kv ==0)
return false;
else
return checkprime(kv--,nv);
}

I changed it so that the functions has two arguements. I still get the stack flow. I am making it simpler by reducing kv by one each recursive call. In main, i set k = n/2, where n is the number to be checked and called the function as follows checkprime(k,n). Why is it that even though the function parameter changed it still does nothing? Afterall n has to remain constant because thats the number being checked. K which represents the divisors has to be dynamic, it must change to determine primality. Any help appreicated.