Why is in the definition of the space of continuous functions vanishing at infinity from a space $Ω$ to $ℝ$, $Ω$ often assumed to be locally compact? Let


*

*$\Omega$ be a topological space

*$C(\Omega)$ denote the set of continuous functions from $\Omega$ to $\mathbb R$

*$C_b(\Omega)$ denote the set of bounded functions in $C(\Omega)$ equipped with $$\left\|f\right\|_\infty:=\sup_{x\in\Omega}|f(x)|\;\;\;\text{for }f:\Omega\to\mathbb R$$
Now, let $$\operatorname{supp}f:=\overline{\left\{x\in\Omega:f(x)\ne0\right\}}$$ and $$C_c(\Omega):=\left\{f\in C(\Omega):\operatorname{supp}f\text{ is compact}\right\}.$$ Clearly, $C_c(\Omega)$ is a (not necessarily closed) subspace of $C_b(\Omega)$. Let $C_0(\Omega)$ denote the completion of $C_c(\Omega)$ with respect to $\left\|\;\cdot\;\right\|_\infty$.
If $f\in C_0(\Omega)$ and $\varepsilon>0$, there is a $g\in C_c(\Omega)$ with $$\left\|f-g\right\|_\infty<\varepsilon\tag1.$$ Since $g\in C_c(\Omega)$, $$K:=\operatorname{supp}g$$ is compact and $$g(x)=0\;\;\;\text{for all }x\in\Omega\setminus K\tag2.$$ Thus, $$|f(x)|\le|f(x)-g(x)|+|g(x)|<\varepsilon\;\;\;\text{for all }x\in\Omega\setminus K\tag3.$$ In particular, $f$ is a limit of a sequence of such $g$ in $C_b(\Omega)$ and hence itself an element of the $\mathbb R$-Banach space $C_b(\Omega)$.

Question:
  
  
*
  
*How can we show the converse, i.e. that $$\left\{f\in C_b(\Omega):\forall\varepsilon:\exists K\subseteq\Omega:K\text{ is compact and }|f(x)|<\varepsilon\text{ for all }x\in\Omega\setminus K\right\}=C_0(\Omega)?$$
  
*By 1. the set on the left-hand side is a $\mathbb R$-Banach space. In the literature, I've often seen that $\Omega$ is assumed to be locally compact (and Hausdorff) or separable. What's the reason for these assumptions?
  

 A: For the first point given$f \in C_b(\Omega)$ in the left-hand side set you need to prove that for any $\varepsilon >0$ there exist $g \in C_c(\Omega)$ such that  $\|f-g\|_\infty \leq \varepsilon$.
So let $\varepsilon >0$. By definition there exist a compact set $K$ such that $|f(x)| \leq \varepsilon $ for all $x \notin K$.

Let us assume that there exist $\chi$ a continuous function such that $\operatorname{supp} \chi$ is compact, $\chi(x)=1$ for all $x \in K$ and $\forall x \in \Omega$  we have $0 \leq \chi(x) \leq 1$.

Then with:
$$g=f\chi$$ 
you have:


*

*$\operatorname{supp} g \subset \operatorname{supp} \chi$ has a compact support

*For $x \in K$, $|f(x)-g(x)| =0 \leq \varepsilon$

*For $x \notin K$ $|f(x)-g(x)| = |f(x)| |1-\chi(x)| \leq \varepsilon \cdot 1$
so $g$ is indeed in $C_c(\Omega)$ and such that $\|f-fg\|_\infty \leq \varepsilon$.
The answer of your second point lies in the function $\chi$. You need some assumptions about $\Omega$ to have the existence of such function for any compact. 
A: @Delta-u already provided a nice answer to the first question. Let me elaborate on the second one with this simple example.
Let $X$ be a Banach space. Then $C_c(X)\neq 0$ if and only if $X$ is finite-dimensional.
Proof: (I only show that $C_c(X)=0$ if $X$ is infinite-dimensional. The converse is easy). Let $f\in C_c(X)$ and argue by contradiction that $f\neq 0$. Then, there exists $U\subset f(X)\subset \mathbb{R}$ with $U$ open and $0\notin U$. By continuity of $f$, the set $f^{-1}(U)\subset \mathrm{supp} f$ is open and relatively compact, since $\mathrm{supp} f$ is compact.
This is a contradiction since on an infinite-dimensional Banach space every relatively compact open set is the empty set. This is because closed balls are not compact.
This is to say that the local compactness of $\Omega$ is necessary in order to have a meaningful space $C_c(\Omega)$. Separability alone is not sufficient (take $\Omega=X$ a separable infinite-dimensional Banach space). Clearly, the same holds for $C_0(\Omega)$. In short: $C_0(\Omega)$ might be too small.
Bonus. Occasionally, when $(\Omega,d)$ is a metric space, one is tempted to replace $C_0(\Omega)$ with $C_0(\Omega,d)$ the space of bounded continuous functions with $d$-bounded support (bounded is important because we do not have Weierstrass theorem, so functions with $d$-bounded support may be unbounded even though continuous!).
However, $C_0(\Omega,d)$ depends on $d$, not only on the topology $\tau_d$ generated by $d$. Indeed, $d$ and $d\wedge 1$ generate the same topology, but (for example) $C_0(\Omega,d\wedge 1)=C_b(\Omega)$ is separable if and only if $(\Omega,\tau_d)$ is compact (metrizable), while $C_0(\Omega,d)$ is separable as soon as $(\Omega,d)$ is proper (i.e.: all balls are precompact), since in that case $C_0(\Omega,d)=C_c(\Omega,\tau_d)$.
Generally, one uses $C_c(\Omega)$ or $C_0(\Omega)$ because they are separable, but the replacement $C_0(\Omega,d)$ might not be. In short: $C_0(\Omega,d)$ might be too large.
