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.
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,