# Can $f$ ever has uncountable number of Local maxima or minima? [duplicate]

This question suddenly came to my mind (May be very silly question...)

Suppose $f$ is a continuous function over $\mathbb{R}$ and twice differentiable. Can $f$ ever has uncountable number of Local maxima or minima? (Twice differentiablity can be ignored for finitely many points).

I was thinking of counter-example (obviously), but could not find one.(I am really really bad at finding counter-example actually!)

I thought about the example $x^2\sin\Big(\dfrac{1}{x}\Big)$ when $x\neq 0$, and $0$, when $x=0$, but this function is not twice differentiable everywhere.

• Note that this is not possible in $\mathbb C$, since a complex valued function with uncountably many zeroes must be identically zero by a version of the identity theorem. But that doesn't mean it isn't possible in $\mathbb R$. – wythagoras Aug 23 '17 at 8:13