Let $f$ be continuous on the real numbers. Let $c$ be in real number with $f(x)=c$ for all $x$ in $\mathbb{Q}$. Show that $f(x)=c$ on $\mathbb{R}$. Can someone solve this question?

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

thank you
 A: You could look at it with sequences, but there is actually a cleaner (but more abstract) way to look at it.
Since $f$ is continuous and $\{c\}$ is closed, $f^{-1}(c)$ is a closed set. But that closed set contains $\Bbb Q$. Therefore... (what can you say about the closure of a dense subset of $\Bbb R$?)
A: Hint: use limits, the density of $\Bbb Q$, and the fact $f$ is continuous.
A: Let $x\in \mathbb R$. Recall a very basic fact: If $f$ is continuous, and $p_n\to x$ then $f(p_n)\to f(x)$. 
Now, can you explain why you can find a sequence of rational numbers $(p_n)$ such that $p_n \to x$?
With such a sequence, express $f(x)$ as $\lim_{n\to \infty} f(p_n) $. What do you know about $f(p_n)$? What does that tell you about the limit you just wrote? So, what is the value $f(x)$? 
A: For any $x\in\Bbb R$, you can find $\left(x_n\right)_{n\in \Bbb N} \in \Bbb Q ^\Bbb N$ so that $x_n \underset{n\to+\infty}{\longrightarrow}x$
The fact that $f$ is continuous tells you that $f$ and $\lim\limits_{n\to+\infty}$ commute, i.e. $f\left(\lim\limits_{n\to+\infty}x_n\right)=\lim\limits_{n\to+\infty}f\left(x_n\right)$
So you have: $f(x)=f\left(\lim\limits_{n\to+\infty}x_n\right)=\lim\limits_{n\to+\infty}f\left(x_n\right)=\lim\limits_{n\to+\infty}c=c$
