# An example of uniform convergence on compact sets but not uniform convergence?

As the title suggests, I want to find an example where a sequence of continuous functions $\{f_n\}$ converges uniformly on compact sets to a continuous function $f$, and yet the convergence is not uniform over the whole domain. Thank you in advance!

Take $f_n:(0,1)\to \mathbb R$, with $f(x)=x^n$.
$x^n$ on $[0,1)$: the compact subsets are contained in $[0,r]$ for some $r<1$.
The functions $g_n(x) = \frac{x^n}{n!}e^{-x}$ are another example. They have the property that $\displaystyle \lim_{n\to\infty} g_n =0$, but you can check that $\displaystyle \int_0^\infty g_n dx = 1$ for all $n$.
Even simpler, try $$f_n(x)=\frac xn$$ and $$f(x)=0$$, defined for all real $$x$$.