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 trialsumitpaul
3,118 PointsWhy is this not working?
NSMutableArray *elements = [NSMutableArray arrayWithObjects: nil];
2 Answers
Rashii Henry
16,433 PointsWell, if you're referring to question 1 in the code challenge the question doesn't ask you to initialize the array. It only want you to create it. When you create it without initializing it, its size automatically defaults to 0, until you add items to it. Therefore, you're output should be
NSMutableArray *elements = [NSMutableArray array];
sumitpaul
3,118 PointsThanks Rashii. I figured it out. Your answer is probably write too. But this worked for me:
NSMutableArray *elements = [NSMutableArray arrayWithCapacity: 0];
Rashii Henry
16,433 PointsNo problem. Its so many different ways to achieve results when you're coding so I'm just glad i was able to provide another solution.