Refer to Exercise $24$ and related results in Math 245A Note 2 for this problem.
Exercise $24$: Show that a function ${f: {\bf R}^d \rightarrow {\bf C}}$ is measurable if and only if it is the pointwise almost everywhere limit of continuous functions ${f_n: {\bf R}^d \rightarrow {\bf C}}$. (Hint: if ${f: {\bf R}^d \rightarrow {\bf C}}$ is measurable and ${n \geq 1}$, show that there exists a continuous function ${f_n: {\bf R}^d \rightarrow {\bf C}}$ for which the set ${\{ x \in B(0,n): |f(x)-f_n(x)| \geq 1/n \}}$ has measure at most ${\frac{1}{2^n}}$. You may find Exercise $25$ below to be useful for this.)
proof: Let ${f: {\bf R}^d \rightarrow {\bf C}}$ be measurable, and $\varepsilon > 0$. By Exercise 25, there is a measurable set ${E \subset {\bf R}^d}$ of measure at most $\varepsilon$ outside of which $f1_{B(0,n)}$ is locally bounded. In particular, $f1_{B(0,n) \backslash E}$ is bounded and thus absolutely integrable. By Theorem 15, there exists a continuous, compactly supported $f_n$ such that $\|f1_{B(0,n) \backslash E} - f_n\|_{L^1({\bf R}^d)} \leq \varepsilon$. By monotonicity we have
\begin{align*}
&\frac{1}{n} \cdot m({\{ x \in B(0,n): |f(x)-f_n(x)| \geq 1/n \}})
\\
&\leq \frac{1}{n} \cdot m(\{x \in B(0,n) \backslash E: |f(x) - f_n(x)| \geq 1/n\}) + \frac{1}{n} m(E)
\\
&\leq \|f1_{B(0,n) \backslash E} - f_n\|_{L^1({\bf R}^d)} + \frac{1}{n} m(E)
\\
&\leq \varepsilon(1 + \frac{1}{n}).
\end{align*}
By choosing $\varepsilon \leq \frac{1}{(n+1)2^n}$, we get a continuous function ${f_n: {\bf R}^d \rightarrow {\bf C}}$ for which the set $A_n := {\{ x \in B(0,n): |f(x)-f_n(x)| \geq 1/n \}}$ has measure at most $1 / 2^n$. Let $F := \{x \in {\bf R}^d: f_n(x) \not\rightarrow f(x)\}$. For every $x \in F$, there exists $N > 0$ such that $x \in A_n$ for all $n \geq N$. Hence $F \subset \bigcup_{N = 1}^\infty \bigcap_{n \geq N} A_n$, and we get $m(F) = 0$.
Conversely, if ${f: {\bf R}^d \rightarrow {\bf C}}$ is the pointwise almost everywhere limit of continuous functions ${f_n: {\bf R}^d \rightarrow {\bf C}}$, then $f$ is measurable by $(1)$ and $(4)$ of Exercise $8$.