Error Code -1

Hi,
My build went fine and printed out in the console just fine. But the final line was “Program ended with exit code: -1”

Here was my code:

#include <stdio.h>

int main(int argc, const char * argv[])
{
// Declare a variable
float shoe;

// Assign number
shoe = 9.5;

float shoe2;

shoe2 = 7.5;

// Declare a variable of type double
double pair;

pair = shoe + shoe2;
printf("Size of J & T's feet = %f size. \n", pair);
return 0;

}

Hey Billygoat,

I copied the code exactly as you have it on the forum and everything looks correct.

Size of J & T’s feet = 17.000000 size.
Program ended with exit code: 0

Can you try rerunning the command and circle back on the forum?

Thanks

Hi…

When I try my code, I get an error which I am having trouble looking up. I get: "passing ‘double’ to parameter of incompatible type ‘const. char’"
Can someone help explain what this error means? Also can someone help me figure out how I invoked it? Thank you.

#include <stdio.h>

int main(int argc, const char * argv[]) {
float first = 3.14;
float second = 42.03;
double = first + second;
printf(third);
}

The problem I believe is that you don’t have a variable name “third” after the word “double”.

[quote]#include <stdio.h>
int main(int argc, const char * argv[]) {
float first = 3.14;
float second = 42.03;
double = first + second;
printf(third);
}
[/quote]
Look at this code:

[code]#include <stdio.h>

int main (int argc, const char * argv[]) {
float first = 3.14;
float second = 42.03;
double third = first + second;
printf ("%f", third);
}
[/code]
Can you see where you went wrong?

yea. It doesn’t look like the chapter explains this. Only the example code was given: printf(" Cook it for %f minutes.\ n", cookingTime); (Location 623) When I read this I thought “minutes” was the variable (my mistake) so I thought that the variable was expected to be within the quotations.
Anyway. Thank you.

The result concatenated with some random stuff:
45.169998Program ended with exit code: 0

Is there a way to exclude that and only get the result?

My code was this:
#include <stdio.h>

int main(int argc, const char * argv[]) {
float first = 3.14;
float second = 42.03;
double third = first + second;
printf("%f",third);
return 0;
}

If you put a newline character at the end of the format specifier, that will have the result on a line by itself.