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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Michael Reining](https://secure.gravatar.com/avatar/c585cb5e43e3726b808ba02c72b83457?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Michael Reining
10,101 PointsPlease help stuck with simple array challenge - print the size in bytes of "real_numbers" array
The challenge is:
Using the printf function print the size in bytes of the variable "real_numbers". Your output should look like the following: "Array real_numbers is x bytes."
My input is:
float real_numbers[5];
printf("Array realy_numbers is %ld bytes.\n", sizeof(real_numbers));
When I enter the above code into Xcode it correctly prints the statement and tells me that the array is 20 bytes.
The error message says:
That was not the correct string. Do you have the correct format character? sizeof(real_numbers) returns a long. That format character is '%ld'.
Would appreciate some help so I can proceed and pass this challenge.
![Lukasz R](https://secure.gravatar.com/avatar/224ff8bddf51a63b5bc0ecb7b66699a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lukasz R
707 PointsWhat's the exact error code from web-editor? :)
![Michael Reining](https://secure.gravatar.com/avatar/c585cb5e43e3726b808ba02c72b83457?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Michael Reining
10,101 PointsThat was not the correct string. Do you have the correct format character? sizeof(real_numbers) returns a long. That format character is '%ld'.
![Lukasz R](https://secure.gravatar.com/avatar/224ff8bddf51a63b5bc0ecb7b66699a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lukasz R
707 PointsYou have typo there: realy_numbers instead of real_numbers :)
![Michael Reining](https://secure.gravatar.com/avatar/c585cb5e43e3726b808ba02c72b83457?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Michael Reining
10,101 PointsDoh! Thank you so much. No wonder that Xcode let it pass. Really appreciate your help
![Lukasz R](https://secure.gravatar.com/avatar/224ff8bddf51a63b5bc0ecb7b66699a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lukasz R
707 PointsNo prob :) Just finished my 'objective-c basics' and had some time before proceeding to next steps :)
4 Answers
![Michael Reining](https://secure.gravatar.com/avatar/c585cb5e43e3726b808ba02c72b83457?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Michael Reining
10,101 PointsLesson: Pay more attention to typos in strings. ;)
![Jin Jiang](https://secure.gravatar.com/avatar/9638907235bb47868294d4197220e47f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jin Jiang
273 Pointsfloat real_numbers []= {1, 2, 3, 4, 5}; printf("Array real_numbers is %ld bytes.", sizeof(real_numbers)/sizeof(float)); that's what i typed, what's wrong with this one?
![dungeonkeeperhf](https://secure.gravatar.com/avatar/821680df164ea306e4940ba906b152c6?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
dungeonkeeperhf
3,272 Pointsfloat is not a whole number, it's a decimal or fraction like 0.3 or 0.56.
![Chris Atlas](https://uploads.teamtreehouse.com/production/profile-photos/837872/micro_Photo_on_7-23-14_at_4.19_PM.jpg)
Chris Atlas
2,038 Pointscan someone help me find my bug?
float real_numbers[5] = {2.1, 1.2, 2.3, 3.3, 4.5}; printf("array real_numbers %ld bytes\n", sizeof(real_numbers));
![Cody Vanleeuwen](https://secure.gravatar.com/avatar/647b4080f40e9f833b3928b1e6606c2d?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Cody Vanleeuwen
294 Pointsi don't think there is any need to make up those numbers,
real_numbers[5];
printf("Array real_numbers is %ld bytes.\n", sizeof(real_numbers));
Michael Reining
10,101 PointsMichael Reining
10,101 PointsAlso, if anyone knows how to add a proper line break with markdown in post above please let me know so I can leave questions / comments that are more readable.