Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Lincoln Sills
1,214 PointsBasic C code won't compile in Treehouse
Program runs and complies as it should in Xcode and returns the correct value although it won't accept it. Please help, thanks
float real_numbers[] = {1.1, 2.2, 3.3, 4.4, 5.5}; printf("float %ld bytes\n", sizeof(float)); printf("Array real_numbers is %ld bytes\n", sizeof(real_numbers)); printf("Array real_numbers can store %ld itmes\n", sizeof(real_numbers)/sizeof(float));
4 Answers

Jason Anello
Courses Plus Student 94,597 PointsHey Lincoln,
Your first printf statement isn't asked for in the challenge so I don't know if that will throw it off. You're using \n in your strings instead of a period which could be causing it not to pass.
Also, check your spelling on the last printf statement.

Lincoln Sills
1,214 PointsHere is my problem again:
Code Challenge: Print the length of the array real_numbers using the sizeof() function. Your output should look like the following: Array real_numbers can store x items.
My Solution:
float real_numbers[] = {1.1, 2.2, 3.3, 4.4, 5.5}; printf("Array real_numbers is %ld bytes.", sizeof(real_numbers)); printf("Array real_numbers can store %ld times.", sizeof(real_numbers)/sizeof(float));
works in Xcode only, Thank you

Jason Anello
Courses Plus Student 94,597 PointsI didn't recheck the code challenge again but I think the end of the string was items and not times

Lincoln Sills
1,214 PointsThank you for the quick response and catching those mistakes but that didn't fix it. I am just moving on, as long as it works in Xcode without any problems it would seem to me that it is ok to just move on. Your thoughts?

Jason Anello
Courses Plus Student 94,597 PointsI would recommend that you complete the challenges Even if earning the points and badges aren't important to you it's still a learning experience. I know sometimes it may seem like you're jumping through hoops just to satisfy the code checker but I think you'll be a better programmer if you stick with it and figure out what it requires.
I think you'll find that a lot of times in programming things need to be an exact way. So I think it's good practice to read the instructions carefully and make sure that you are providing exactly what is required.

Lincoln Sills
1,214 PointsI see your logic... thank you for your help and input. That was the problem, I was using times and not items.