Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Objective-C Basics (Retired) Fundamentals of C Arrays

Output ends with 0

The output should read.

Euler's number = 2.71828

float math_contants[2]; math_constants[0] = 2.71828; math_constants[1] = 1.14828;

printf("Euler's number = %f\n" , math_constants[0]);

return 0;

When I run it in Xcode the output reads "Euler's number = 2.718280 program ended with exit code: 0

Why did I get the question wrong?

I wish it would show the answer and explain why.

2 Answers

Gareth Borcherds
Gareth Borcherds
9,372 Points

Is there a reason you added the return 0;?

The code challenge doesn't require it and actually makes you fail, even though the rest of your code is right.

Thank you so much. I added the "return 0;" because I was under the impression that you needed it to print to the output.

Gareth Borcherds
Gareth Borcherds
9,372 Points

Nope, just the printf statement will do the job.