We have $(u_t)_t = c^2 (u_x)_x$. Moreover, for $u$ sufficiently smooth, we have $(u_x)_t = (u_t)_x$. Therefore, we can write the first-order system of conservation laws ${\bf u}_t + {\bf A}{\bf u}_x = {\bf 0}$ (see e.g. this post), where ${\bf u} = (u_x,u_t)^\top$ and
\begin{aligned}
{\bf A} &= \left(\begin{array}{cc}0 & -1\\ -c^2 & 0\end{array}\right) \\
&= \left(\begin{array}{cc}1/c & -1/c\\ 1& 1\end{array}\right)\left(\begin{array}{cc}-c & 0\\ 0 & c\end{array}\right) \left(\begin{array}{cc}c/2 & 1/2\\ -c/2 & 1/2\end{array}\right)
= {\bf P}\, {\bf \Lambda}\, {\bf P}^{-1} .
\end{aligned}
Now, setting ${\bf v} = {\bf P}^{-1} {\bf u}$, one obtains ${\bf v}_t + {\bf \Lambda}{\bf v}_x = {\bf 0}$. The solution to the initial value problem ${\bf v}(x,0) = (v_1^0(x),v_2^0(x))^\top$ is ${\bf v}(x,t) = (v_1^0(x+ct),v_2^0(x-ct))^\top$, where
$$
\left(\begin{array}{c}
v_1^0(\xi) \\
v_2^0(\xi)
\end{array}\right)
=
{\bf P}^{-1} \left(\begin{array}{c}
u_x(0,\xi) \\
u_t(0,\xi)
\end{array}\right)
=
{\bf P}^{-1} \left(\begin{array}{c}
f'(\xi) \\
g(\xi)
\end{array}\right) ,
$$
and $f'$ is the derivative of $f$.
Going back to the initial unknowns, we have ${\bf u}(x,t) = {\bf P}\, {\bf v}(x,t)$, i.e.
\begin{aligned}
u_x(x,t) &= \frac{1}{2}\left(f'(x+ct) + f'(x-ct)\right) + \frac{1}{2c}\left(g(x+ct) - g(x-ct)\right) ,\\
u_t(x,t) &= \frac{1}{2}\left(g(x+ct) + g(x-ct)\right) + \frac{c}{2}\left(f'(x+ct) - f'(x-ct)\right) .
\end{aligned}
Finally, $u$ is obtained by integration of $u_t$ with respect to $t$,
$$
u(x,t) = \frac{1}{2}\left(f(x+ct) + f(x-ct)\right) + \frac{1}{2c} \int_{x-ct}^{x+ct} g(s)\,\text{d}s \, ,
$$
and one recognizes the well-known d'Alembert's formula.
The same method applies to the mixed type problem (see this post where the case $h=0$ is solved). First, it is solved in the characteristic fields where the linear system of conservation laws is diagonal. Then, we go back to the initial unknowns.