Use recursive to deal with this. First if n < 0 then calculate its positive one then 1 / its reuslt, then, check if current n is even, it it is, calculate its pow(x*x), if not, calculate its pow(x * x) *x.
The idea behind it is power of something is equal its bigger base power of lower power, i.e.
x^n = (x^ 2)^(n/2)
Error:
1. Do not take care of the number overflow, always remember, if it has something about the type, abs(INT_MIN) = abs(INT_MAX + 1), so sometimes we will meet the error.