Suppose that $f:\mathbb{R} \rightarrow \mathbb{R}$ is continuous on $\mathbb{R}$ and that $f(r)=0$ for all $r \in \mathbb{Q}$. Prove that $f(x)=0$ for all $x \in \mathbb{R}$.
My attempt: Define a sequence $(x_n)$ where $x_n \in \mathbb{Q}$ for all $n \in \mathbb{N}$ and assume that $(x_n) \rightarrow a \not\in \mathbb{Q}$. Since $f$ is continuous, we have $\lim_n{f(x_n)}=f(a)=0$. Since $a$ is arbitrary irrational number, we have $f(a)=0$ for all $a \not\in \mathbb{Q}$. Hence, we proved the statement.
Is my proof valid? or is there any flaw ?