Are continuous functions with compact support bounded?

While studying measure theory I came across the following fact: $\mathcal{K}(X) \subset C_b(X)$ (meaning the continuous functions with compact support are a subset of the bounded continuous functions). This seems somehow odd to me; I’ve tried to prove it but did not succeed. Could someone help me out here?

Thanks!

Solutions Collecting From Web of "Are continuous functions with compact support bounded?"

We have
$$f(X)\subseteq\{0\}\cup f(\mathrm{supp}(f)),$$
which is compact in $\mathbb{R}$ (since $\mathrm{supp}(f)$ is compact and $f$ is continuous), hence bounded.

If you do know the Weierstraß theorem, then you can prove it like that:

Let $f \in \mathcal{K}(X)$ and denote by $K$ the support of $f$. Then $f|_{K^c}=0$ by the very definition of the support. Moreover, by the Weierstraß theorem, $f|_K$ is bounded. Combining both facts, proves that $f$ is bounded.

If you do not know the Weierstraß theorem, then have e.g. a look at this answer (note that the proof does not only work for a compact interval $[a,b]$, but for any compact set $K$).