The complex entity
complex, parameter :: x = (1., 4.)
has real part
1. and complex part
4.. We can access these individual components as
real(x) ! The real component aimag(x) ! The complex component x%re ! The real component y%im ! The complex component
x%.. form is new to Fortran 2008 and not widely supported in compilers. This form, however, may be used to directly set the individual components of a complex variable
complex y y%re = 0. y%im = 1.