Using the complex.h header files complex number functions?

   851   3   0
User Avatar
Member
4 posts
Joined: Aug. 2021
Offline
I'm having some trouble utilising the constructor function from the complex number function, as I am not entirely sure of the syntax of the function, help would be appreciated.
User Avatar
Member
7770 posts
Joined: Sept. 2011
Offline
The constructor function CMPLX is just a regular function that takes two float arguments.

for example:
complex z = CMPLX(3.14, 2.227);
printf("%d", cimag(z))
printf("%d", creal(z))

2.227
3.14

You can also use the struct constructer style
complex C = {1.5, 0.5};
User Avatar
Member
4 posts
Joined: Aug. 2021
Offline
Just impemented the mandelbrot set with the functions, thanks for your help!
User Avatar
Member
7770 posts
Joined: Sept. 2011
Offline
_GandalfTheGay_
Just impemented the mandelbrot set with the functions, thanks for your help!

Nice! Don't forget to enable 64bit if you plan on zooming in much.
  • Quick Links