Let $f(x)$ be a continuous real-valued function on $\mathbb{R}$. If it is differentiable at every $x\neq0$ and if $\lim_{x\rightarrow0}f'(x)$ exists, does it imply that $f(x)$ is differentiable at $x=0$ ?

Intuitively it should be true but I think there might be a counterexample, which exploits switching limits and uniform continuity.

-

Yes, it implies that $f$ is differentiable at $x=0$, with $f'(0) = \mathop {\lim }\limits_{x \to 0} f'(x)$. This can be easily proved using the mean-value theorem.
Proof: Let $l=\lim _{x \to 0} f'(x)$. Let us first show that $$\mathop {\lim }\limits_{h \to 0^ + } \frac{{f(h) - f(0)}}{h} = l.$$ Let $\varepsilon > 0$. Then, since $\lim _{x \to 0^+} f'(x) = l$, there exists $\delta > 0$ such that $$|f'(x) - l| < \varepsilon$$ for any $x \in (0,\delta)$. Suppose next that $h \in (0,\delta)$. Since $f$ is continuous on $[0,h]$ and differentiable on $(0,h)$, by the mean-value theorem there exists $c \in (0,h)$ such that $$f'(c) = \frac{{f(h) - f(0)}}{h}.$$ Noting that $c \in (0,\delta)$, we thus have $$|f'(c) - l| < \varepsilon.$$ So, given any $\varepsilon > 0$, there exists $\delta > 0$ such that $h \in (0,\delta)$ implies $$\bigg|\frac{{f(h) - f(0)}}{h} - l \bigg| < \varepsilon.$$ Thus, by definition of (one-side) limit, we have $$\mathop {\lim }\limits_{h \to 0^ + } \frac{{f(h) - f(0)}}{h} = l.$$ Analogously, $$\mathop {\lim }\limits_{h \to 0^ - } \frac{{f(h) - f(0)}}{h} = l.$$ Hence $$\mathop {\lim }\limits_{h \to 0 } \frac{{f(h) - f(0)}}{h} = l,$$ that is $$f'(0) = l.$$