Why $f$ is Lebesgue-measurable? $f_n\to f$ almost everywhere.

$$\{f_n \}_{n=1}^{\infty}$$ : sequence of Lebesgue-measurable functions $$(f_n : \mathbb{R} \to \overline{\mathbb{R}})$$

$$\displaystyle\lim_{n\to \infty} f_n (x)=f(x)$$ almost everywhere.

Then, prove that $$f$$ is Lebesgue-measurable.

Since $$\displaystyle \lim_{n\to \infty} f_n (x)=f(x)$$ almost everywhere, there exists Lebesgue-measurable set $$N$$ s.t. $$m(N)=0$$ and $$f_n(x) \to f(x)$$ on $$N^c$$.

On $$N^c$$, $$f(x)=\displaystyle \limsup_{n\to \infty} f_n(x)=\liminf_{n\to \infty} f_n(x)$$ $$\cdots (\ast)$$

It seems that I can use the fact that "If $$f_n$$ is Lebesgue measurable, then $$\displaystyle\limsup_{n\to \infty} f_n, \displaystyle\liminf_{n\to \infty} f_n$$ are also Lebesgue-measurable".

However, $$(\ast)$$ holds on only $$N^c$$.

I'm stacked. I would like you to give me some ideas.

Let $$g_n(x)=f_n(x)$$ when $$x \notin N$$ and $$0$$ when $$x \in N$$. Then $$g_n$$ is measurable so $$g \equiv \lim \sup g_n$$ is measurable. Check that $$f=g$$ almost everywhere.
• @Kavi_Rama_Murthy Isn't $g_n(x)$ defined by $g_n(x)=f_n(x)$ when $x\notin N$ and $0$ when $x \in N$?