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
Keiron Lowe2,993 Points
The code challenge is asking me to create an array large enough to hold 2 numbers. If arrays are 0 based, wouldn't the answer be
float math_constants rather than
The first number would be
math_constants and the second
math_constants, so unless I'm missing something I think the answer for this challenge is wrong.
That is a great question. When you initialize an array is different than, when you accessing it by the index. This means that this array:
will have 5 elements of type floats. Remember this is initializing the array. But to access it is based 0. Think about it this way. When initializing you have the compiler how many elements you one.
I hope it makes sense,