A sequence of continuous functions which is pointwise convergent to zero and not uniformly convergent on any interval. The exercise is to construct a sequence of continuous functions $f_n:\mathbb{R}\rightarrow \mathbb{R}, n\in \mathbb{N}$ , which is pointwise convergent to $f(x)=0 , x\in \mathbb{R}$ and not uniformly convergent on any interval $(a,b)$.
I posted this question once and I got the answer, but I had forgotten to mention that $f_n$ must be continuous. The example of sequence of discontinuous functions looks like this:

Let $\{r_n\}_{n\geq 1}$ be an enumeration of the rationals, and define $f_n(x)$ as follows:
  $$
f_n(x)=\begin{cases}
1,& x\in \{r_k\}_{k\geq n}\\
0,& else
\end{cases}
$$

The person, who posted this, made the remark: 

If you want to make the $\{f_n\}$ continuous, you can modify this example by using bump functions supported on $(r_n-2^{-n},r_n+2^{-n})$ in place of the spikes to $1$ at $r_n$.

I'm not realy sure what he meant. I was thinking of defining $g_k$ as a broken line or maybe more smooth function going through $(r_k-2^{-k},0), (r_k,1), (r_k+2^{-k},0)$ and zero on $\mathbb{R}\setminus [r_k-2^{-k},r_k+2^{-k}]$ and then defining $f_n(x)=\sup\{g_k(x):k\ge n\}$.  But I don't know whether it converges to zero and whether $f_n$ are even continuous.
On the other hand I have found this topic
A sequence of continuous functions on $[0,1]$ which converge pointwise a.e. but does not converge uniformly on any interval
and there is only an example of a sequence converging to zero almost everywhere. That's why I begin to doubt that there exists a sequence converging to zero everywhere (that would mean there is a mistake in my book because the exercise says "construct such a sequence").
 A: According to the hint in "Problems in Mathematical Analysis", Biler and Witkowski, problem 4.112.
Define $g_n$ as the function which is $0$ on the intervals $(-\infty, 0]$ and $[2/n,\infty)$, $1$ at $1/n$, and linear otherwise.  Then $g_n$ converges pointwise to $0$ but is not uniform in any interval containing $0$.
Now define $$f_n(x) = \sum_{k=0}^{\infty} 2^{-k} g_n(x - r_k).$$
Then the $f_n$ are continuous, converge pointwise to $0$, but do not converge uniformly on any open interval. 
A: There is indeed such a sequence, as one can show using a Baire category
argument, using a suitable Banach space.
Let $C_{b}\left(\mathbb{R}\right)$ denote the space of bounded, continuous
functions and let
$$
V:=\left\{ \left(f_{n}\right)_{n\in\mathbb{N}}\in\left(C_{b}\left(\mathbb{R}\right)\right)^{\mathbb{N}}\,\middle|\,\left\Vert f\right\Vert _{V}:=\sup_{n\in\mathbb{N}}\left\Vert f_{n}\right\Vert _{\infty}<\infty\right\} .
$$
It is not hard to see that this is a Banach space, equipped with $\left\Vert \cdot\right\Vert _{V}$.
Furthermore, define
$$
V_{0}:=\left\{ \left(f_{n}\right)_{n\in\mathbb{N}}\in V\,\middle|\,\forall x\in\mathbb{R}:\quad f_{n}\left(x\right)\xrightarrow[n\to\infty]{}0\right\} .
$$
Then $V_{0}$ is complete, since it is a closed subspace of $V$.
To see this, let $\left(g^{\left(m\right)}\right)_{m\in\mathbb{N}}=\left(\left(g_{n}^{\left(m\right)}\right)_{n\in\mathbb{N}}\right)_{m\in\mathbb{N}}$
be a sequence in $V_{0}$ with $g^{\left(m\right)}\xrightarrow[m\to\infty]{}g=\left(g_{n}\right)_{n\in\mathbb{N}}\in V$.
We want to show $g\in V_{0}$. To this end, let $x\in\mathbb{R}$
and $\varepsilon>0$ be arbitrary. Then, there is some $m_{0}\in\mathbb{N}$
with $\left\Vert g^{\left(m\right)}-g\right\Vert _{V}<\frac{\varepsilon}{2}$
for all $m\geq m_{0}$. Because of $g^{\left(m_{0}\right)}\in V_{0}$,
we have $g_{n}^{\left(m_{0}\right)}\left(x\right)\xrightarrow[n\to\infty]{}0$,
so that there is $n_{0}\in\mathbb{N}$ with $\left|g_{n}^{\left(m_{0}\right)}\left(x\right)\right|<\frac{\varepsilon}{2}$
for all $n\geq n_{0}$. But for $n\geq n_{0}$, this implies
\begin{align*}
\left|g_{n}\left(x\right)\right| & \leq\left|g_{n}\left(x\right)-g_{n}^{\left(m_{0}\right)}\left(x\right)\right|+\left|g_{n}^{\left(m_{0}\right)}\left(x\right)\right|\\
 & \leq\left\Vert g-g^{\left(m_{0}\right)}\right\Vert _{V}+\frac{\varepsilon}{2}\\
 & <\frac{\varepsilon}{2}+\frac{\varepsilon}{2}=\varepsilon.
\end{align*}
Hence, $g_{n}\left(x\right)\xrightarrow[n\to\infty]{}0$. Since $x\in\mathbb{R}$
was arbitrary, we have shown $g\in V_{0}$, so that $V_{0}\leq V$
is closed and hence complete.
Now, let $\emptyset\neq I=\left(a,b\right)\subset\mathbb{R}$ be an
arbitrary open, bounded, nonempty interval and set
$$
V_{0}^{\left(I\right)}:=\left\{ \left(f_{n}\right)_{n\in\mathbb{N}}\in V_{0}\,\middle|\,\left(f_{n}\right)_{n\in\mathbb{N}}\text{ does {\color{red}not} converge uniformly on }I\right\} .
$$
I claim that $V_{0}^{\left(I\right)}\subset V_{0}$ is open and dense.
Indeed,


*

*$\left(V_{0}^{\left(I\right)}\right)^{c}\subset V_{0}$ is closed,
because for a sequence $\left(g^{\left(m\right)}\right)_{m\in\mathbb{N}}=\left(\left(g_{n}^{\left(m\right)}\right)_{n\in\mathbb{N}}\right)_{m\in\mathbb{N}}$
in $\left(V_{0}^{\left(I\right)}\right)^{c}$ with $g^{\left(m\right)}\xrightarrow[m\to\infty]{}g=\left(g_{n}\right)_{n\in\mathbb{N}}\in V_{0}$,
and $\varepsilon>0$, the following holds: There is some $m_{0}\in\mathbb{N}$
with $\left\Vert g-g^{\left(m\right)}\right\Vert _{V}<\frac{\varepsilon}{2}$
for all $m\geq m_{0}$. Furthermore, since $g^{\left(m_{0}\right)}\in\left(V_{0}^{\left(I\right)}\right)^{c}$,
there is $n_{0}\in\mathbb{N}$ with
$$
\frac{\varepsilon}{2}>\left\Vert g_{n}^{\left(m_{0}\right)}\right\Vert _{\sup,I}:=\sup_{x\in I}\left|g_{n}^{\left(m_{0}\right)}\left(x\right)\right|
$$
for all $n\geq n_{0}$. But this implies
\begin{align*}
\left\Vert g_{n}\right\Vert _{\sup,I} & \leq\left\Vert g_{n}-g_{n}^{\left(m_{0}\right)}\right\Vert _{\sup,I}+\left\Vert g_{n}^{\left(m_{0}\right)}\right\Vert _{\sup,I}\\
 & \leq\left\Vert g-g^{\left(m_{0}\right)}\right\Vert _{V}+\left\Vert g_{n}^{\left(m_{0}\right)}\right\Vert _{\sup,I}\\
 & <\varepsilon
\end{align*}
for all $n\geq n_{0}$ and thus $g=\left(g_{n}\right)_{n\in\mathbb{N}}\in\left(V_{0}^{\left(I\right)}\right)^{c}$.

*To see that $V_{0}^{\left(I\right)}\subset V_{0}$ is dense, let $g=\left(g_{n}\right)_{n\in\mathbb{N}}\in V_{0}$
be arbitrary. We want to show $g\in\overline{V_{0}^{\left(I\right)}}$.
If $g\in V_{0}^{\left(I\right)}$, this is clear. Hence, we can assume
$g\notin V_{0}^{\left(I\right)}$, i.e. $g_{n}\to0$ uniformly on
$I$. Now, let $\varepsilon>0$ be arbitrary. We want to find some
$h=\left(h_{n}\right)_{n\in\mathbb{N}}\in V_{0}^{\left(I\right)}$with
$\left\Vert g-h\right\Vert _{V}\leq\varepsilon$. To this end, let
$f_{n}\equiv0$ for $n\leq\frac{2}{b-a}$, i.e. for $a+\frac{2}{n}\geq b$.
For $n>\frac{2}{b-a}$, define
$$
f_{n}\left(x\right):=\begin{cases}
0, & \text{if }x\leq a,\\
\varepsilon\cdot n\left(x-a\right), & \text{if }a\leq x\leq a+\frac{1}{n},\\
\varepsilon\cdot\left(1-n\cdot\left(x-a-\frac{1}{n}\right)\right), & \text{if }a+\frac{1}{n}\leq x\leq a+\frac{2}{n},\\
0, & \text{if }x\geq a+\frac{2}{n}.
\end{cases}
$$
It is clear that $f:=\left(f_{n}\right)_{n\in\mathbb{N}}\in V_{0}$
(pointwise convergence is clear for $x\leq a$. But for $x>a$, we
have $x\geq a+\frac{1}{n}$ for all $n\geq n_{x}$ and hence $f_{n}\left(x\right)=0$)
with $\left\Vert f\right\Vert _{V}=\varepsilon$. Furthermore, we
have $\left\Vert f_{n}\right\Vert _{\sup,I}=\varepsilon$ for all
$n>\frac{2}{b-a}$ and hence $\left(f_{n}\right)_{n\in\mathbb{N}}$
does not converge uniformly (to $0$) on $I$. Thus, neither does
$h:=\left(h_{n}\right)_{n\in\mathbb{N}}:=\left(f_{n}+g_{n}\right)_{n\in\mathbb{N}}$,
because otherwise, $f_{n}=h_{n}+\left(-g_{n}\right)\to0$ uniformly
on $I$, by uniform convergence of $\left(g_{n}\right)_{n\in\mathbb{N}}$.
Altogether, $h\in V_{0}^{\left(I\right)}$ with $\left\Vert g-h\right\Vert _{V}=\left\Vert f\right\Vert _{V}=\varepsilon$,
so that $V_{0}^{\left(I\right)}\subset V_{0}$ is dense.
Finally, let
$$
J:=\left\{ \left(a,b\right)\,\middle|\, a,b\in\mathbb{Q}\text{ and }a<b\right\} .
$$
Then $J$ is countable, so that Baire's theorem shows that
$$
M:=\bigcap_{I\in J}V_{0}^{\left(I\right)}\subset V_{0}
$$
is dense. In particular, $M\neq\emptyset$. But any $f=\left(f_{n}\right)_{n\in\mathbb{N}}\in M$
satisfies $f_{n}\to0$ pointwise, but $\left(f_{n}\right)_{n\in\mathbb{N}}$
does not converge uniformly (to $0$) on any interval from $J$. Since
every (nontrivial) interval contains an interval from $J$, we are
done.
