If the integral of a function $f:\mathbb{R}\rightarrow\mathbb{R}$ along an interval symmetric to the origin is zero, is the function odd? $\def\d{\mathrm{d}}$We know that if a function $f:\mathbb{R}\rightarrow\mathbb{R}$ is odd, then$$\int_{-a}^a f(x)\,\d x=0.$$ I'm wondering if the converse is true, and if not, if there are any counterexamples. 
Thanks!
Edit: There was confusion about the quantifier for $a$, and I was also looking for continuity, even though I didn't say that in the question. So to clarify, I was wondering if the following statement was true or false: 
Given a function $f \in C(I)$, if for some $a$ the integral$$\int_{-a}^af(x)\,\d x=0,$$ then $f$ must be odd. 
 A: I assume that $f\in L^1(\mathbb R)$ with $\int_{-a}^af(x)dx=0$ for all $a>0$. In this case, the general answer is "no", and you can easily construct counterexamples by simply taking any odd function and changing it on a set of Lebesgue-measure zero to make it not odd. One such example has been given in JJR's answer for any fixed $a>0$.
However, if $f$ is known to have a classical primitive (i.e. a function $F$ that is differentiable everywhere with $F'=f$), then the answer is "yes" (note that every continuous function has such a primitive). In this case, assuming w.l.o.g. that $F(0)=0$, we have
\begin{align*}
F(a)=\int_0^a f(x)dx
\end{align*}
and hence
\begin{align*}
0=\int_{-a}^a f(x)dx=\int_{-a}^0f(x)dx+\int_0^af(x)dx=-F(-a)+F(a),
\end{align*}
which shows $F(-a)=F(a)$ for all $a\in\mathbb R$. Thus $F$ is even and hence $f$ is odd. (See also here for more details on that last conclusion).
A: $f(x) = \left\{
\begin{array}{ll} 
1 & \text{ if }x\in[-a,a]\cap\mathbb{Q}\\
0 & \text{ else} \end{array}\right.$
A: Counter-example (sketch):
Consider the function, defined on $[-1,1]$ as
$$f(x)=\begin{cases}x&\text{if }\;0\le x<\frac12,\\
x-1&\text{if }\;\frac12< x\le 1,\\
0& \text{if }\;-1\le x<0.
\end{cases}$$
For a continuous function on $[-1,1]$, consider the function defined by
$$f(x)=\begin{cases}\sin (2\pi x)&\text{if }\;0\le x\le 1,\\
0& \text{if }\;-1\le x<0.
\end{cases}$$
A: The statement is not true, simple counterexample is $f(x) = \cos x$ on $[-\pi,\pi]$ since $\int_{-\pi}^\pi \cos x \,dx=0$.
