1 2 3 4 5 6 7
#include <complex.h> // for cabs, cimag, creal, complex #include <math.h> // for hypot double cabs(double complex z) { return hypot(creal(z), cimag(z)); }