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!

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) Functional Programming in C Loops

second element in array

I don't get why this is correct char letters [ ] = {'a','b','c','d'};

letters [1];

wouldn't it be letter[4];

2 Answers

Stone Preston
Stone Preston
42,016 Points

the second element in the array is letters[1] since array indexes start at 0. the first element is letters[0], the second is letters[1], the third is letters[2] and the fourth is letters[3].

letters[4] is out of the bounds of the array.

alright got ya