V
void main
I'm rather new to complex numbers in C and was wondering, how do I
initialize a complex variable properly if the imaginary part is 0.
I tried
--------
#include <complex.h>
float complex c = 1.0f;
--------
and was told:
Error ctest.c: 3 invalid initialization type; found 'float' expected 'struct long double _Complex'
--------
#include <complex.h>
float complex c = 1.0f + I * 0.0f;
--------
and
--------
#include <complex.h>
float complex c = 1.0f + 0.0f * I;
--------
but both got me
Error c:\tests\clc\ctest.c 3 Compiler error (trap). Stopping compilation
What am I doing wrong?
initialize a complex variable properly if the imaginary part is 0.
I tried
--------
#include <complex.h>
float complex c = 1.0f;
--------
and was told:
Error ctest.c: 3 invalid initialization type; found 'float' expected 'struct long double _Complex'
--------
#include <complex.h>
float complex c = 1.0f + I * 0.0f;
--------
and
--------
#include <complex.h>
float complex c = 1.0f + 0.0f * I;
--------
but both got me
Error c:\tests\clc\ctest.c 3 Compiler error (trap). Stopping compilation
What am I doing wrong?