Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8903801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:57:38+00:00 2026-06-15T01:57:38+00:00

Possible Duplicate: How to work with complex numbers in C? So I have this

  • 0

Possible Duplicate:
How to work with complex numbers in C?

So I have this piece of C code that compiles with errors saying that ‘complex’ does not name a type:

#include <stdio.h>
#include <complex.h>
#include <math.h>

int main ()
{
    int B=9;
    double theta;

    double complex w;
    float x,y;

    x= 5*cos (theta) - 2;
    y= 5*sin (theta);


    double complex z=x+y*I;
    w=z+(B/z);

    for(theta=0;theta<=360;theta=+30)
    { printf ("%.2f  %.2f  %.2f  %.2f",creal(z), cimag(z),y,creal(w), cimag(w));
        printf ("/n");
    } 

    return 0;

    system ("pause");
}

I already include the <complex.h> so why is there still an error for the ‘complex’. There are also other errors, but let just focus on this one first.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:57:39+00:00Added an answer on June 15, 2026 at 1:57 am

    Are you using GCC as your compiler? If yes, you need to enable C99 support by using the -std=c99 or -std=gnu99 compiler flag.

    Also, declare variables before you use them. Here:

    double complex z=x+y*I;
    

    neither x nor y have been declared yet. Of course you also need to initialize them. For example:

    float x = 5 * cos(theta) - 2;
    float y = 5 * sin(theta);
    double complex z = x + y * I;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why does this simple std::thread example not work? Code: #include <iostream> #include
Possible Duplicate: How does foreach work when looping through function results? If I have
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Possible Duplicate: How does this work? Weird Towers of Hanoi Solution While surfing Google,
Possible Duplicate: How can I make XSLT work in chrome? I have this XML
Possible Duplicate: Returning a reference can work? Why this code works ( matrix is
Possible Duplicate: how does jquery chaining work? This is a normal thing you would
Possible Duplicate: How does this bash fork bomb work? Today one of my friend
Possible Duplicate: Simple C scanf does not work? Why does scanf(%c, &letter); not working.
Possible Duplicate: How does rand() work? Does it have certain tendencies? Is there something

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.