Sign in to follow this  
bobwrit

complex output

Recommended Posts

In C, you can get the real and imaginary part of a complex number via the creal() and cimag() functions for double complex numbers, crealf() and cimagf() for float complex numbers and creall() and cimagl() for long double complex numbers. They return double, float and long double values respectively, which can then be passed to printf() with the standard floating point format specifiers.

Share this post


Link to post
Share on other sites
I had tried that before but somethings wrong with the functions in complex.h. I can't use any of the functions in the header, but the _Complex structure still works.
I've also tried to specify the imaginary and real parts of the variable using x.real and x.imag.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this