Let $X$ be a locally compact Hausdorff space and $K$ be a compact subset of $X$. Then any function $f\in C(K)$ can be extended to a function in $C(X)$ which vanishes outside a compact set.
I have searched several books for the proof. It seems that the authors believe it is just an exercise-level proposition. Since $X$ is an LCH space, we can always find open set $V$ containing $K$ with compact closure $\overline{V}$ and we can extend $f$ to $\overline{V}$ by classical Tietze extension theorem. I also know the fact that $f\in C(K)$ implies that the the range of $f$ is contained in a closed interval $[a,b]$, but how do we define a $F \in C(X)$ satisfying the requirements?