From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fcomplex%2Fcomplex.html | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 devdocs/c/numeric%2Fcomplex%2Fcomplex.html (limited to 'devdocs/c/numeric%2Fcomplex%2Fcomplex.html') diff --git a/devdocs/c/numeric%2Fcomplex%2Fcomplex.html b/devdocs/c/numeric%2Fcomplex%2Fcomplex.html new file mode 100644 index 00000000..9ca58d2c --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fcomplex.html @@ -0,0 +1,37 @@ +

complex

Defined in header <complex.h>
#define complex _Complex
+
(since C99)

This macro expands to a type specifier used to identify complex types.

+

A program may undefine and perhaps then redefine the complex macro.

+

Example

#include <stdio.h>
+#include <complex.h>
+#include <math.h>
+ 
+void print_complex(const char* note, complex z)
+{
+    printf("%s %f%+f*i\n", note, creal(z), cimag(z));
+}
+ 
+int main(void)
+{
+    double complex z = -1.0 + 2.0*I;
+    print_complex("z  =", z);
+    print_complex("z\u00B2 =", z * z);
+    double complex z2 = ccos(2.0 * carg(z)) + csin(2.0 * carg(z))*I;
+    print_complex("z\u00B2 =", cabs(z) * cabs(z) * z2);
+}

Output:

+
z  = -1.000000+2.000000*i
+z² = -3.000000-4.000000*i
+z² = -3.000000-4.000000*i

References

See also

+
+
(C99)
imaginary type macro
(keyword macro)
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/complex/complex +

+
-- cgit v1.2.3