Consider the function $$f(x)= \begin{cases}0&\text{if }x\in\Bbb{R}\setminus\Bbb{Q}~\text{or}~x=0\\\frac{1}{q}&\text{if }x=\frac{p}{q}, p\in\Bbb{Z},q\in\Bbb{N},(p,q)=1\end{cases}$$
Of course this function is discontinuous at rational numbers. To show it is continuous at irrational numbers I need: If $x_n\to x$, with $x_n=\frac{p_n}{q_n}$, and $x_n\ne x,n\in\Bbb{N}$, then $\lim_{n\to\infty} q_n=\infty$.
How to do that?
Let us assume that $(q_n)_{n \in \mathbb{N}}$ has a bounded subsequence - say w.l.o.g. that $(q_n)_{n \in \mathbb{N}}$ is already bounded. Then we have $$|q_n x - p_n | \longrightarrow 0.$$ So $(p_n)_{n \in \mathbb{N}}$ is also bounded. Since both are integers, there exists a subsequence $(n_k)_{k \in \mathbb{N}}$ such that $p_{n_k} = p$ and $q_{n_k} = q$. (We have only finite number of possible values, but infinity many elements.) Therefore, we find that $$x= \frac{p}{q},$$ i.e. $x$ is rational.