If $f$ is any real-valued function, we define its zero set $Z_f = \{ x : f(x) = 0 \}$. Obviously, the zero set of a nice function can be uncountable. e.g., if $f(x) = 0$ on an uncountable domain.

I would like a sufficient condition on functions $f : \mathbb R \to \mathbb R$ for which the following statement holds: $$\mbox{if $Z_f$ is uncountable, then it contains an interval}.$$

If $X_t$ denotes a Brownian motion, then with probability one, the zero set of $X_t$ is homeomorphic to a Cantor set (hence is uncountable but contains no interval). Since $X_t$ is $\tfrac{1}{2}$-Hölder continuous, this is obviously not sufficient.

**Edit:** Due to Joel David Hamkin's elegant counterexample below, continuous differentiability is not a sufficient condition for the above statement to hold. Is there a natural sufficient condition?

**Edit 2:** Thanks, all. I've accepted Joel's answer because it doesn't seem like there is a solution to my problem at this level of generality. The motivation for the question comes from stochastic geometry. I take a realization of a random Riemannian metric $g$ on the Euclidean plane, and consider a certain geodesic $\gamma$. Such a curve is (a.s.) smooth but certainly not analytic.

Given the random environment $g$, the path of the geodesic is determined. I then look at the intersection of the geodesic with a given line segment or circular arc. This intersection could be empty, finite, countably infinite, or uncountable. Under the hypotheses in my model, I have already shown that it cannot be an interval. I was hoping that a general argument would reduce other cases of uncountability to that case, proving that the intersection is countable. I may just have to deal with the possibility it can be uncountable, or find a context-specific argument.

`$C^\infty$'' is not enough, as you remarked below.`

Analytic'' is enough, by well-known theorems in complex analysis. $\endgroup$