Real-analysis about discontinuous function (Dirichlet function.) For an extreme example we take the so-called Dirichlet function.
$$f(x)=
\begin{cases}
1,&\text{if $x$ is rational}\\
0,&\text{if $x$ is irrational}
\end{cases}$$
The function $f$ is discontinuous at all $c \in R$
Proof:
Suppose $c$ is rational. Take a sequence {${x_n}$} of irrational numbers such that $\lim x_n =c$.
 Then $f(x_n) = 0$ and so $\lim f(x_n) = 0$ but $f(c) = 1$
I know why $f(x_n) = 0$, but I don't understand why  $\lim f(x_n) = 0$. 
Because of  definition of discontinuous,  $\lim f(x_n) \neq f(c) $ 
but there is $\lim x_n = c$, which means that $\lim f(x_n) = f(c)$
Anybody can explain why $\lim f(x_n) = 0 $ and why $\lim f(x_n) \neq f(c)$ not because of definition of discontinuous. 
 A: Lets follow to the proof you had presented.
You assumed that $c$ is rational. Then by the definition of the function $f$, we have $f(c)=1$. Further, you also assumed that $(x_n)$ is a sequence of irrational numbers such that it converges to $c$. So, its clear from this that for every $n\geq 1$, the number $x_n$ is irrational and hence, using the definition of the function $f$ again, we have $f(x_n)=0$ for all $n\geq 1$. Thus.
$$\lim_{n\to\infty}f(x_n)=\lim_{n\to\infty}0=0.$$
Because $f(c)=1$, it follows that 
$$\lim_{n\to\infty}f(x_n)\neq f(c).$$
To summarize, given a rational number $c$, we were able to find a sequence $(x_n)$ for which it converges to $c$ but the sequence $(f(x_n))$ does not converge to $f(c)$. Using the Discontinuity Criterion, we conclude that $f$ is discontinuous at $c$.
A: If $f(x_n)=0 $ for all values of $n$, as is the case here, then the sequence $f(x_n)$ is $0,0,0,0,0\ldots,$ i.e. the sequence of all zeros. The limit of this sequence is zero... what else? This is what we mean by $\lim_{n\to \infty}f(x_n),$ so $\lim_{n\to \infty}f(x_n)=0.$
You appear to be confused. The reason that the limit is zero is the one I just gave. The fact that the function is discontinuous is a consequence. The fact that we have $\lim_n x_n = c$ and $\lim_n f(x_n) \ne f(c)$ means that the function is not continuous. This is because it is a theorem that if $f$ is continuous at $c$ then for every sequence $x_n$ that converges to $c,$ the sequence $f(x_n)$ converges to $f(c).$ Since this example violates that theorem, it must not be continiuous at $c.$
A: If you understand the first issue then you may understand the second.
The sequence $(x_{n})$ is by construction a sequence of irrational numbers. The function $f$ takes every irrational and gives $0$. So $f(x_{n}) = 0$ for all $n$. Now what is the limit of a sequence of a given constant, say $0$? Simply $= 0$. (try to check it by the definition of limit directly.).
Now $c$ is chosen to be a rational number. And the set of all irrational numbers is dense in $\mathbb{R}$; so for every real number there is some sequence of irrational numbers converging to the real number. In particular, the number $c$ being rational implies $c \in \mathbb{R}$; so we can find a sequence of irrational numbers $x_{n}$ ensuring $x_{n} \to c$ as $n \to \infty$. By construction $f(c) = 1$, and we knew that $f(x_{n}) \to 0$ as $n \to \infty$; so $\lim_{n \to \infty}f(x_{n}) \neq f(c)$. We have found that for every rational $c$ there is some sequence $(x_{n})$ of irrationals such that $x_{n} \to c$ and $f(x_{n}) \not\to f(c)$; so $f$ is not continuous.
