TITLE: Is there a function having a limit at every point while being nowhere continuous?
QUESTION [30 upvotes]: Is there a function $\,f:\mathbb{R}\rightarrow\mathbb{R},\,$ which has a limit at every $x\in\mathbb R$ and is everywhere discontinuous?

REPLY [31 votes]: Answer. No.
Instead, the following is true: If a function $f:\mathbb R\to\mathbb R$ has a limit for every $x\in\mathbb R$, then $f$ is discontinuous in a set of points which is at most countable.
More specifically, we have the following facts:
Fact A. If $g(x)=\lim_{y\to x}f(y)$, then $g$ is continuous everywhere.
Fact B. The set $A=\{x: f(x)\ne g(x)\}$ is countable.
Fact C. The function $\,f\,$ is continuous at $\,x=x_0\,$ if and only if $\,f(x_0)=g(x_0)$, and hence $f$ is discontinuous in at most countably many points. 
For Fact A, let $x\in\mathbb R$ and $\varepsilon>0$, then there exists a $\delta>0$, such that
$$
0<\lvert y-x\rvert<\delta\quad\Longrightarrow\quad  g(x)-\varepsilon<f(y)<g(x)+\varepsilon,
$$
but the above inequality implies that for every $z$, with $|z-x|<\delta$,
$$
g(x)-\varepsilon \le g(z)=\lim_{y\to z}f(y) \le g(x)+\varepsilon,
$$
and hence $g$ is continuous.
For Fact B, define for $\varepsilon>0$ the set
$$A_\varepsilon=\{x: \lvert\,f(x)- g(x)\rvert>\varepsilon\}.$$ This set cannot have a limit point, for otherwise, $f$ would not have a limit there. Thus $A_\varepsilon$ is at most countable. Next observe that
$$
A=\bigcup_{n\in\mathbb N}A_{1/n},
$$
and hence $A$, the set of discontinuities of $f$, is at most countable.
Fact C is straight-forward.