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


Arrays, Length, and Size

I noticed a difference in my bytes size. In the video it shows 12, However my computer said 20! is this because I am running on a 64 bit system?

Here is what I had.

int main()
    float numbers[] = {11.11, 22,22, 33,33};
    printf("float %ld bytes\n", sizeof(float));
    printf("number %ld bytes\n", sizeof(numbers));
    printf("array length %ld bytes\n", sizeof(numbers)/sizeof(float));
    return 0;


Here is the output:

float 4 bytes
number 20 bytes
array length 5 bytes

3 Answers

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

That calculation is right. You have 5 numbers in your array {11.11, 22, 22, 33, 33}. I am assuming you meant to add a decimal but ended up separating them by a comma. 5 * 4 bytes = 20 bytes total

Stone Preston
Stone Preston
42,016 Points

It might not necessarily be because of your 64 bit processor. Most of the times sizes of data types vary from compiler to compiler (or interpreter to interpreter I guess with java.). So it could be they are using a different version in the video than you are using.

LOL you are correct Amit good catch. Coding at 5am has it's drawbacks : )