Define $f(x)$ by $$f(x) = \left\{\begin{array}{cc}x,&x\in\mathbb{Q}\\0,&x \notin \mathbb{Q}.\end{array}\right.$$
Show that $\lim_{x \to 0} f(x)=0$ but $\lim_{x \to c} f(x)$ does not exist for any $c \neq 0$.
My attempt:
At $x = c$, the right hand limit (RHL) is $\begin{align} \lim_{x \to c^{+}}f(x) & = \lim_{h \to 0} f(c + h) \\ & = \lim_{h \to 0} c + h \\ & = \lim_{h \to 0} c + 0 \\ & = c. \tag{3}\label{3} \end{align}$
The left hand limit (LHL) is $\begin{align} \lim_{x \to c^{-}}f(x) & = \lim_{h \to 0}f(c - h) \\ & = \lim_{h \to 0} 0 \\ & = 0. \tag{4}\label{4} \end{align}$
From $\ref{3}$ and $\ref{4}$,
$$\lim_{x \to c^{+}}f(x) \neq \lim_{x \to c^{-}}f(x),$$
so the limit does not exist at $x = c$.
Regarding the first part, for any $x \in \mathbb{R}$ it should be clear that $|f(x)|\leq |x|$ (note this is trivially true for irrationals), hence
$$\lim_{h\to 0} |f(0+h)| \leq \lim_{h \to 0} |0+h| = 0$$ so $\lim_{h\to 0} f(0+h) = 0 = f(0)$, hence $f$ is continuous at $x=0$.
On the other hand, take any $c \neq 0$. If $f$ were continuous at $c$ then we would need to show that for any $\epsilon > 0$ there exists some $\delta>0$ so that if $|x-c|<\delta$ then $|f(x)-f(c)|<\epsilon$.
To show that this doesn't work take any $\delta>0$, if $c$ is rational then choose $x$ irrational in $(c-\delta, c+\delta)$, if $c$ is irrational then choose $x$ rational in $(c-\delta,c+\delta)$ so that $|c|<|x|$, in either case, given that $c\neq 0$ we have $$|f(x)-f(c )| = \begin{cases}|c| & c\in\mathbb{Q}\setminus \{0\}\\|x| & c\not\in\mathbb{Q}\\\end{cases} \geq |c| > 0$$ so $\epsilon$ cannot be made smaller than $|c|$, so there is no continuity at any $c\neq 0$.