Distribution of zeroes of a continuous function I'm interested in the possible distribution of zeroes in a closed interval $[a,b] \subset \mathbb{R}$ of a continuous function $f:\mathbb{R} \rightarrow \mathbb{R}$ that is non-constant in any open interval. 


*

*I managed to show that if the zeroes are uniformly distributed, then the set of zeroes in $[a,b]$ can be at most finite otherwise they would form a dense set which would imply that the function is constant. 

*I'm curious about the possible number of accumulation points in $[a,b]$. I conjecture that there can be countably many but I haven't managed to construct an explicit example of a function satisfying this requirement. 

*I also believe but I haven't managed to show that there can't be uncountably many accumulation points in $[a,b]$.


Is there a general theorem in analysis or general topology which addresses these particular questions?
 A: Let $C \subset [0,1]$ be a Cantor set (could be the standard middle-thirds one, could be a fat Cantor set), and
$$f(t) = \operatorname{dist}(t,C) = \inf \{ \lvert t-c\rvert : c \in C\}.$$
Then $f\colon [0,1] \to [0,1]$ is a continuous function with $C = f^{-1}(0)$, and $f$ is not constant on any nondegenerate interval. Since Cantor sets are perfect, $f^{-1}(0)$ has uncountably many ($2^{\aleph_0}$) accumulation points.
Every closed subset of a metric space is the zero set of a continuous function, and if the domain is an interval, one can always arrange it so that the function is not constant on any interval not intersecting the zero set. Thus for an interval, every closed subset with empty interior is the zero set of a continuous function that is not constant on any interval.
A: Part $2$ is solved fast by the function:
$f(x)=\cases{x\sin(1/x)) \text{ if } x\neq 0\\ 0 \text{ if } x=0}$
It has a countable number of zeroes in the interval $[0,1]$.

Sorry, the previous set of discontinuities was countable but had only one accumulation point, the following does the trick:
Take the set $A=\frac{1}{2^n}+\frac{1}{2^m}$ with $n$ and $m$ positive naturals. As in Daniel's answer we can take the function $f(x)=d(x,A)$. The accumulation points are precisely $0$ and $\frac{1}{2^n}$ for positive $n$.
