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) Pointers and Memory Array Size and Length

Andrew Dempsey
Andrew Dempsey
2,667 Points

number of items in array

The challenge asks for me to declare an array that will hold five floats. Since the array is 0-indexed, shouldn't the correct response be ```float real_numbers[4];

rather than 
```float real_numbers[5];

2 Answers

Alex Hedley
Alex Hedley
16,378 Points

There's a difference between declaring an array of a certain size and accessing elements in that array.

They are zero based index but to create it you have to say how big you want it.

type arrayName [ arraySize ];