How to work with complex numbers in C?

I have a problem with the creation of complex numbers in the C language. In si there is a library complex.h , but to create it I can't, visualy swears. The challenge is to create a dynamic array of complex type.
Here is the code :
#include <stdio.h>
#include <complex.h>
int main()
 double complex z1 = 1.0 + 3.0 * I;
 double complex z2 = 1.0 - 4.0 * I;

VS says that is not enough ; when z1 , z2.
March 19th 20 at 08:34
4 answers
March 19th 20 at 08:36
In VS scanty implementation of complex numbers.
There is no implementation of type complex, and no full-fledged concept of "i".

Because of this, you can't declare and initialize a complex number as in your example (and the standard).
To initialize complex numbers you can use the macros: _FCbuild(re, im)/_CBuild(re,im)
the prefix F for float, C for double.
In itself a complex number is declared as follows: double _Val[2];
Other variants for float and long double.

No implementation of built-in operations (+-*/), i.e. you cannot write z1 + z2 - is a compilation error.
For multiplication function, the other operations, implement on their own.
But in the library there is a set of mathematical functions for complex argument, which is good.

In fact, you can not use offered by Microsoft type _C_float_complex (or equivalents), and to use more clear your own implementation, such as suggested by @kaela_Lind Math library functions will work with her normal (under certain conditions), just have to be types.

In General, open complex.h from the composition of the VS and study, it is quite simple.

PS: In gcc the complete implementation in accordance with the standard.
March 19th 20 at 08:38
VS writes...

in C89 there is no complex.h he appeared in C99. VS does not support C99. Therefore complex.h you have -- non-standard. Need to watch it to understand how to use it.
(I suspect that I have to get the double word of variable definitions).
March 19th 20 at 08:40
didn't even know what complex numbers are supported. Always used
typedef struct {
 float re;
 float im;
} comp, *pcomp
March 19th 20 at 08:42
In C you have to pack a complex number using structure and write functions that will be used at the same time it is possible to apply faster, or optimized for the processor, algorithms

Find more questions by tags C