$$\newcommand\norm[1]{\left\lVert#1\right\rVert}$$
Show that $A=\{f\in C_c(\mathbb{R}): I(f)=0\}$ is a dense subspace in $L^2(\mathbb{R})$ where $I(f)=\int_{\mathbb{R}}f$ is a continuous linear operator on $C_c(\mathbb{R})$. Here $C_c(\mathbb{R})$ is the space of continuous functions with compact support.
We know that $C_c(\mathbb{R})$ is dense in $L^2(\mathbb{R}).$ So we can find $\phi\in C_c(\mathbb{R})$ such that, $$||f-\phi||_2<\epsilon.$$
Now I want to find $\psi\in A$ that is close to $\phi.$ For this, I was trying to consider the functions $e_n=\frac{1}{n}\mathbf{1}_{[0,n]}$ for $n\in \mathbb{N}.$ Then these functions have compact support and $\norm{e_n}_2\to 0.$ Then we could perhaps look at $\phi_n=\phi-\phi*e_n$, then $\norm{\phi_n-\phi}_2\to 0$ since $\norm{\phi_n-\phi}_2\leq \norm{\phi}_1\norm{e_n}_2.$ I just have to show that, $I(\phi_n)=0.$ So we try to compute this, $$I(\phi_n)=\int \phi(x)dx - \frac{1}{n}\int_{[0,n]} \int \phi(x-y)dxdy=V-\frac{1}{n}\int_{[0,n]}Vdy=0$$ where $V=\int \phi(x)dx.$ So now we can do something like, $$\norm{f-\phi_n}_2\leq \norm{f-\phi}_2+\norm{\phi-\phi_n}_2\leq \epsilon$$ for large enough $n$. Is this reasoning correct?