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 trialArt Carter
625 PointsArray 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?
1 Answer
J.D. Sandifer
18,813 PointsIf 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...)
Rodrigo Chousal
16,009 PointsRodrigo Chousal
16,009 PointsHi Art! Could you post your code? Maybe I can help you out.