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 trialChris Taylor
3,446 Pointssecond 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
42,016 Pointsthe 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.
Chris Taylor
3,446 Pointsalright got ya