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 trialJohn Dyer
Courses Plus Student 761 PointsChallenge task 2 of 3 error
Howdy...I am entering printf("real_numbers is %ld bytes.", sizeof(real_numbers)); for this challenge but I keep getting an error. Keeps complaining about the format character.
4 Answers
Gregory Serfaty
37,140 Pointsis your array is like this float real_numbers[5]; ?
Calvin Nix
43,828 PointsHey John,
There is no need for the parenthesis around real_numbers
.
You simply need a space between sizeof and real_numbers.
i.e sizeof real_numbers
John Dyer
Courses Plus Student 761 PointsCalvin,
Your suggestion works fine in Xcode :
printf("real_numbers is %ld bytes\n", sizeof real_numbers);
Not in the challenge though.....keep getting the following error:
Bummer! Make sure you are calling printf and passing a string (not an NSString) and "real_numbers" as the parameters. The correct format option is '%ld'.
Not too fussed, just wanted to report it to see if it was something that needs fixing in the challenge itself.
Thanks for your help.
Calvin Nix
43,828 PointsHey John,
I just tested the code challenge and I passed it using the following code.
printf("Array real_numbers is %ld bytes", sizeof real_numbers);
It is possible that the \n
is messing it up.
Edit: Plus, your formatting is not correct. You need to also include the word 'Array' and the beginning of your string. Code challenges are very picky :)