Skip to content

Instantly share code, notes, and snippets.

@appleparan
Created February 5, 2020 05:49
Show Gist options
  • Save appleparan/4b1254e7bee5225fd233c76fc0d47304 to your computer and use it in GitHub Desktop.
Save appleparan/4b1254e7bee5225fd233c76fc0d47304 to your computer and use it in GitHub Desktop.
Complex usage in C
#include <stdio.h>
#include <complex.h>
/*
Compile option : icc -std=c99 main.c -o main
*/
int main() {
double complex a;
a = 1.0 + I * 2.0;
printf("%f + i%f\n", creal(a), cimag(a)); // 1.000 + i2.000
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment