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) Fundamentals of C Arrays

Array syntax

In the video on Arrays, the instructor declares an array: float numbers-geeks_love[ ] = {3.145, 1.618, 1.4142};

When I attempt to declare an array in the exercise, it says I must declare the number of elements in the brackets [3]

When I tried it with a number in the brackets, I got the same error message.

I opened Xcode an tried it without the number inside and it compiled and ran fine.

Any explanation?

Rodrigo Chousal
Rodrigo Chousal
16,009 Points

Hi Art! Could you post your code? Maybe I can help you out.

1 Answer

J.D. Sandifer
J.D. Sandifer
18,813 Points

If I remember correctly, the challenge asked you to create an array large enough for three items. That's all! You don't need to put items in the array - it should stay empty.

Re-read the directions and follow them exactly. Typically, the challenges are simpler than you expect. (Please note: I didn't say easier, I said simpler. Sometimes I find it harder to only right the code the challenge asks for...)