The question is: Prove that if $f:\mathbb{R}\to\mathbb{R}$ is continuous and $f(x) = 0$ whenever $x$ is rational, then $f(x) = 0$ for all $x\in\mathbb{R}$.
My proof:
Let $ x\in\mathbb{R} $. If $ x\in\mathbb{Q}$, then $ f(x)=0 $.
Otherwise $ x\in\mathbb{R\backslash Q} $. Then there exists a sequence of rational numbers $ (q_n)_{n\in\mathbb{N}}$ (for example $q_n= \frac{\lfloor{nx\rfloor}}{n} ,\forall n\in\mathbb{N}$) such that $q_n\to x$ as $n\to \infty$. By the properties of $f$, we have $f(q_n)=0$ for all $n\in\mathbb{N}$. So $f(q_n)\to 0$ as $n\to \infty$. Since $f$ is continuous, $q_n\to x$ implies that $f(q_n)\to f(x)=0$. So $f(x) = 0$ for all $x\in\mathbb{R}$.
Thank you for any help.