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 Array

Using variables

When we created "numbers_geeks_love" array we used float variable. And also when we created "primes" array we used int variable. Can we use int variable for "number_geeks_love" array? Or float variable for "primes" array? Does it really matter which variable we use for creating arrays?

1 Answer

Stone Preston
Stone Preston
42,016 Points

the datatype of the array is the datatype the array can store. So if you had an array declared like this

float someArray[5];

that array could hold 5 float values. It cant hold any other data type, only floats.

or

int someOtherArray[6];

that array could hold 6 int values.

so yes, it does matter

Thanks for your help.