Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.