The limit of $f(x) = \begin{cases} x & x\text{ rational} \\ -x & x\text{ irrational}\end{cases}.$ 
Let $f : \mathbb{R} \to \mathbb{R}$ be a function defined by 
$$f(x) = \begin{cases} x & x\in \mathbb{Q} \\ -x & x \in \mathbb{Q}^c \end{cases}.$$
prove that $\lim_{x \to c} f(x)$ exists iff $c=0$.

1) Suppose that $c=0$, $\epsilon >0$, and choose $\delta = \epsilon$.
If $0<|x-0|< \delta$ then $|f(x)-0|=|f(x)|=|x|<\epsilon$
By definition of the limit this means that $\lim_{x \to 0} f(x)=0$
2) Let $\lim_{x \to c} f(x)$ exists, say $L$, and we want to show that $c=0$.
$\lim_{x \to c} f(x)=L$, this means that 
$\forall \epsilon >0, \exists \delta >0, |x-c|<\delta$ then $|f(x)-L|<\epsilon$
How can I complete that, please?
 A: Your last assertion is true for $\epsilon=\frac{|L|}{2}$. So you can choose a $\delta>0$ such that if $|x-c|<\delta$, then $|f(x)-L|<\frac{|L|}{2}\iff L-\frac{|L|}{2}<f(x)<L+\frac{|L|}{2}$. Check that this forces $f(x)$ to be of constant sign for all $x$ such that $|x-c|<\delta$, and then conclude by finding both a rational and an irrational $x$ in this ball.
A: As pointed out by Mars Plastic in the comments, the limit at c exists if for any sequence such that $$x_n \rightarrow c \implies f(x_n)\rightarrow L$$
We will construct such a sequence:
Note: $\mathbb{Q}$ and $\mathbb{Q}^c$ are dense in $\mathbb{R}$, so for any small distance from any number $c$, one can find a rational or irrational number.
Let $c\neq 0$
Let $x_1\in \mathbb{Q}$ such that $|x_1-c|<1$
Let $x_2\in \mathbb{Q}^c$ such that $|x_2-c|<1/2$
Let $x_3\in \mathbb{Q}$ such that $|x_3-c|<1/3$
Repeating this process an infinite number of times creates a sequence such that $|x_n-c|<1/n \rightarrow 0$. Therefore $x_n\rightarrow c$
However we can show that the sequence $f(x_n)$ does not converge if $c\neq 0$. 
