For me, it returned "1" for every number above 2 it seems. Edit: iMalc is correct: there is a case where both ifs don't go through and thus you get an unitialized value (could be anything). Duh.
I think the problem is your if(i*i>n) ? Is that an optimization, because the for loop will still run, so it's not much of an optimization. You should just return the value directly. Also, please indent the code inside of your if statements, it's standard formatting and easier to read.
Here's a quick version I wrote, with a few changes (needs math.h for sqrt and stdlib.h for abs):
int isprime(int n)
if(n < 0)
n=abs(n); //incase it's negative
if(n == 2) // 2 is prime (2*1, 1*2)
if(n == 1 || n % 2 == 0) //if divisible by 2, not prime.
return 0; //1 is not prime by definition
for(i = 3; i < (sqrt(n) + 1); i+=2) //skip every 2, we already checked if it was divisible by 2
if(n % i == 0) //Also: we only have to go up to sqrt(n)+1 (4*4 = 16, so if we go to the sqrt)
return 0; //we are sure to find if it's prime or not