imaginary

Header: <complex.h>

This macro expands to the keyword _Imaginary.

# Declarations

#define imaginary _Imaginary

(since C99)

# Notes

Programs are allowed to undefine and perhaps redefine the imaginary macro.

To date, only Oracle C compiler is known to have implemented imaginary types.

# Example

#include <stdio.h>
#include <complex.h>
 
int main(void)
{
    double imaginary i = -2.0*I; // pure imaginary
    double f = 1.0; // pure real
    double complex z = f + i; // complex number
    printf("z = %.1f%+.1fi\n", creal(z), cimag(z));
}

# See also