Here is my homework.. I'm little bit confused about the range
Write a function bool isprime (int n) which returns true if the passed parameter n is prime. Otherwise, if the numbers is 0, 1 or composite, the function returns false. You should test if numbers d ranging from 2 to sqrt(n)divide n, then n is not a prime. Incorporate this function into a program that uses a testing loop. Each iteration in the loop reads an integer and then prints whether the integer is prime or not.
In your isprime function, you never return false. If it iterates past the for loop, you will be returning nothing from a non-void function, which is illegal behavior.
And according to your problem, your isprime function should be iterating to the sqrt(n) and not the full n.