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) 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