Skip to content

Instantly share code, notes, and snippets.

@prehensilecode
Created February 28, 2017 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prehensilecode/c0c8de06dec4661bc8f5d5c8857be399 to your computer and use it in GitHub Desktop.
Save prehensilecode/c0c8de06dec4661bc8f5d5c8857be399 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <complex.h>
int main(void)
{
float complex c = 3.0 + 4.0 * I;
long d;
d = c;
printf ("%f %+fi\n", creal(c), cimag(c));
printf("%ld\n", d);
c = 3.0 - 4.0 * I;
d = c;
printf ("%f %+fi\n", creal(c), cimag(c));
printf("%ld\n", d);
return (0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment