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) 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,381 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 ];