Theorem: Let $\Omega\subset \mathbb{R}^n$ be an open set and $1\leq p < \infty$. The space $C_c(\Omega)$ is dense in $L^p(\Omega)$.
Haim Brezis has a French book called "Analyse fonctionnelle: theorie et applications" (my version, Análysis Functional: Teoría y aplicaciones, is Spanish) that says:
We know that $C_c(\Omega)$ is dense in $L^1(\Omega)$. So, we can suppose $1<p< \infty$. To prove that $C_c(\Omega)$ is dense in $L^p(\Omega)$ it's enough to show that if $h\in L^{p'}(\Omega)$ satisfies $$\int_\Omega hu=0\,\textit{ for all }\,u\in C_c(\Omega),$$ then $h=0$.
Here $p'$ is a number such that $1/p+1/p'=1$. Could someone explain me why is it enough to prove it?
Note: The rest of the proof is to show that $h$ is locally integrable to conclude that $$\int_\Omega hu=0\text{ for all }u\in C_c(\Omega)\Rightarrow h=0.$$
This proof seems "different" of other proofs (like this one) that uses, for example, approximation by simple functions.
Thanks.
I suspect this is what is going on : Let $X$ denote the closure of $C_c(\Omega)$ in $L^p(\Omega)$, you want to show that $X = L^p(\Omega)$. Suppose not, then by the Hahn-Banach theorem, there must exist a continuous linear function $\varphi : L^p(\Omega) \to \mathbb{C}$ such that $$ \varphi(u) = 0 \quad\forall u \in C_c(\Omega) $$ but $\varphi \neq 0$.
Now, the dual of $L^p$ is $L^{p'}$, so that means that there should exist $h \in L^{p'}$ such that $$ \int hu = 0 \quad\forall u \in C_c(\Omega), \text{ but } h \neq 0 $$ This is what you are trying to contradict. (ie. if no such $h$ exists, then it must happen that $X = L^p(\Omega)$)