5. If the function $f(x)$ satisfies for $x \in \mathbf{R}$: $f(x+999)=-\frac{1}{f(x)}, f(999+x)=f(999-x)$, then $f(x)$
A. is an odd function but not an even function
B. is an even function but not an odd function
C. is both an odd function and an even function
D. is neither an odd function nor an even function