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 trialSteven Ossorio
1,706 PointsProblem declaring arrays
I have a question in regards to the problem being asked. It's asking to declare a float named real_numbers with an array of 5. I've typed up float real_numbers [] = {1,2,3,4,5} and got an error saying remember when saying how many there are you must state it in real_numbers[5]. Is it telling me to go the long way around? such as: float real_numbers[5] real_numbers[0] = 1.1 etc?
Thank you for all your help and explanation to my question.
float real_numbers [] = {1,2,3,4,5}
1 Answer
William Li
Courses Plus Student 26,868 Pointsproblem here is that the on step 1, the challenge only asks you to declare a 5-items float Array variable, but not assigning any values to it just yet.
float real_numbers [5];
This would be suffice. hope it helps.
Greg Kaleka
39,021 PointsGreg Kaleka
39,021 PointsHi Steven,
William's answer looks right to me.
Aside from this, however, you should really be taking this newer version of the Objective-C Basics course, rather than the one you're taking now.
Happy coding!