So, I'm just starting out (excuse my noob-ness), and I'm working on a C program on a Mac with Xcode. It's basically just a scanf() and then a ton of if statements that produce a pre-determined output. I've wrote it so that Xcode compiles it without bitching, but I'm getting a strange "Fix-it" error and no output when I try to run it.
char planet[9];
printf("Input the name of a planet\n");
scanf("%c", &planet);
if (planet == "Earth")
{printf("Earth is 150 million kilometers away from the sun");}
if (planet == "Mars")
{printf("Mars is 220 million kilometers away from the sun");}
if (planet == ("Mercury"))
{printf("Mercury is 57 million kilometers from the sun");}
if (planet == ("Venus"))
{printf("Venus is 108 million kilometers from the sun");}
if (planet == ("Jupiter"))
{printf("Jupiter is 779 million kilometers from the sun");}
if (planet == ("Saturn"))
{printf("Saturn is 1.73 billion kilometers from the sun");}
if (planet == ("Uranus"))
{printf ("Uranus (haha) is 2.88 billion kilometers from the sun");}
if (planet == ("Neptune"))
{printf("Neptune is 4.5 billion kilometers from the sun");}
return 0;
is the code itself but I can't get it to work.
Here's a link to the Xcode project as well.