When is a pointwise limit of a continuous function measurable?

Show that a function $$f$$ : $$\mathbb{R}^d$$$$C$$ is measurable if and only if it is the pointwise almost everywhere limit of continuous functions $$f_n$$ : $$\mathbb{R}^d$$$$\mathbb{C}$$.

I have proven the forwards direction, supposing $$f_n$$ : $$\mathbb{R}^d$$$$\mathbb{C}$$ has pointwise a.e. limit $$f$$ then it is measurable. I need help in the backwards direction.

To prove the backwards direction: So far, I think I have to use Egorov's theorem. So there exists a Lebesgue measureable set A of measurable set A of measure at most some $$\epsilon$$>0 such that $$f_n$$ converges locally uniformly to f on $$\mathbb{R}^d$$\A.

• Egoroff's theorem is only valid for spaces of finite measure. – abhi01nat Oct 21 '20 at 5:12
• Any suggestions on how I should begin the proof? – Frances Oct 21 '20 at 5:18

I will use the following well known result: If $$g$$ is integrable on $$\mathbb R^{d}$$ then, for any $$\epsilon >0$$, we can find a continuous function $$h$$ such that $$\int |g-h| <\epsilon$$.
For each $$n$$ there exists a continuous function $$\phi_n$$ such that $$\phi_n(x)=1$$ if $$\|x|| and $$0$$ if $$\|x|| >n+1$$.
Consider $$\phi_n \arctan f$$. This function is integrable. Hence there exists continuous function $$f_n$$ such that $$\int |\phi_n \arctan f -f_n| <\frac 1n$$. This implies that $$\phi_{n_k} \arctan f -f_{n_k} \to 0$$ almost everywhere for sum subsequence $${n_k}$$. It follows that $$\arctan f -f_{n_k} \to 0$$ almost everywhere (since $$\phi_{n_k}(x)=1$$ fior $$\|x\|\leq n_k$$). Now $$\tan f_{n_k} \to f$$ almost everywhere.