##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# cimagf, cimag, cimagl

From cppreference.com
< c‎ | numeric‎ | complex

Defined in header `<complex.h>` |  |
float cimagf( float complex z ); |  | (since C99)
double cimag( double complex z ); |  | (since C99)
long double cimagl( long double complex z ); |  | (since C99)

Returns the imaginary part of `z`.

### [edit] Parameters

z | - | complex argument

### [edit] Return value

The imaginary part of `z`.

### [edit] Example

Run this code

    #include <stdio.h>
    #include <complex.h>

    int main(void)
    {
        double complex z = 1.0 + 2.0*I;
        printf("%f%+fi\n", creal(z), cimag(z));

        return 0;
    }

Output:

    1.000000+2.000000i

### [edit] See also

creal crealf creall (C99)(C99)(C99) | computes the real part of a complex number (function) [edit]
C++ documentation for imag2

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/numeric/complex/cimag&oldid=71604"