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

Declare a float array named real_numbers with the size of 5.

The question seems really straight forward, but for some reason I keep getting the stupid bummer thing so obviously I am doing something wrong. Ideas? Here is what I have so far...

float real_numbers [] = (3.11, 3.414, 5.17, 5.19, 3.12);

Y'all are awesome by the way!! Thanks for all the help as I learn this new language of coding!! :)

5 Answers

float real_numbers[5] is how you would give the array a size of five. Also, the declarations should be in brackets {} not commas ().

-- Steven

If that solved your problem, please click Best Answer.

Putting real_numbers[5]; creates an empty an array with a length 5. So you have 5 indexes available, 0 ,1, 2, 3, 4.

The answer they are looking for is:

float real_numbers[5];

Nice! Thanks man. Yeah, I realized that after I posted it haha. I thought it was wanting 5 different numbers to make the array length 5. What does it mean if you put the five in [ ]?

so what is the answer?