There isn't such a function. If $f$ is nonzero and continuous at some point $x$, then there is a neighbourhood of $f$ on which $x$ doesn't vanish. Hence if the zero set of $f$ is dense, then the function has to be discontinuous at every value on which it doesn't vanish.
Wojowu
- 28.2k
- 3
- 103
- 185