If $f:\mathbb{R}\to\mathbb{R}$ is continuous and $f(x)=c$ for all $x\in\mathbb{Q}$, then $f(x)=c$ for all $x\in\mathbb{R}$ Can anyone solve this problem?

Let $f$ be continuous on $\mathbb{R}$. Let $c\in \mathbb{R}$ with $f(x)=c$ for all $x\in\mathbb{Q}$. Show that $f(x)=c$ for all $x\in \mathbb{R}$.

I hope someone can solve this problem. Thanks.
 A: Continuity implies $x_n \rightarrow x_0 \Rightarrow f(x_n)\rightarrow f(x_0)$.
$\mathbb{Q}$ is dense in $\mathbb{R}$ which implies $\forall y \in \mathbb{R}$ there is $y_n \in \mathbb{Q}$ such that $y_n \rightarrow y$.
Which means $f(y_n)=c \rightarrow f(y) \Rightarrow f(y)=c$.
Another way to see this is: $f^{-1}(\{c\})$ is closed. But 
$\mathbb{Q} \subset f^{-1}(\{c\}) \Rightarrow \mathbb{R} = \mathrm{Closure}(\mathbb{Q})\subset \mathrm{closure}(f^{-1}(\{c\})=f^{-1}(\{c\}$ since it is closed.
A: By continuity, $\mathbb{Q}$ being dense in $\mathbb{R}$ means that $f(\mathbb{Q}$) is dense in $f(\mathbb{R})$. The only set that $\{c\}$ is dense in is $\{c\}$, so $f(\mathbb{R}) = \{c\}$.
Edit for clarity:
$\mathbb{Q}$ is dense in $\mathbb{R}$, meaning that for any $r \in \mathbb{R}$, there is some sequence $q_n$ of elements of $\mathbb{Q}$ such that $q_n \rightarrow r$. 
For any continuous function $f:\mathbb{R}\rightarrow\mathbb{R}$, the image of $\mathbb{Q}$ dense in the image of $\mathbb{R}$ because for any $f(r)$ in the image of $\mathbb{R}$, $r$ is in $\mathbb{R}$ so there exists a sequence $q_n$ in $\mathbb{Q}$ such that $q_n \rightarrow r$. By continuity, $f(q_n) \rightarrow f(r)$ and $f(q_n)$ is in the image of $\mathbb{Q}$ for each $n$ and so the claim is proved.
Finally, if $\{c\}$ is dense in some set $S$, then for every element $x$ of $S$ there exists a sequence $x_n$ in $\{c\}$ such that $x_n \rightarrow x$. The only sequence $x_n$ in $\{c\}$ is given by $x_n = c$ for all $n$, which tends to $c$. Hence every element of $S$ is $c$, i.e. $S = \{c\}$.
