Getting the amplitude and phase of harmonics in C
You just need to know how to compute magnitude and phase of a complex number $z=z_R+iz_I$:

$$|z|=\sqrt{z_R^2+z_I^2}\\
\arg\{z\}=\left\{\begin{array}{ll}0,&amp;z_R=z_I=0\\
\pi/2&amp;z_R=0,\; z_I&gt;0\\
-\pi/2&amp;z_R=0,\; z_I&lt;0\\
\arctan\left(\frac{z_I}{z_R}\right),&amp;z_R&gt;0\\
\arctan\left(\frac{z_I}{z_R}\right)+\pi,&amp;z_R&lt;0,\;z_I\ge0\\
\arctan\left(\frac{z_I}{z_R}\right)-\pi,&amp;z_R&lt;0,\;z_I&lt;0\\
\end{array}\right.
$$

Luckily, the computation of the phase $\arg\{z\}$ is simplified by the existence of the function atan2 in most programming languages. Watch out, you need to use it like this:

$$\text{phase = }\text{atan2}(z_I,z_R)$$