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) Pointers and Memory Array Size and Length

I don't know why I'm wrong.

So I need to find the size of the array real numbers and all I get as a error is "Bummer! Try again!" and nothing shows in output to even guide me, but when I put the same code in X-Code it prints the size just fine.

Here's my code I put in the challenge:

float real_numbers[]={11.11, 22.22, 33.33, 44.44, 55.55}; printf("array %ld is bytes.\n",sizeof(real_numbers)); return 0;

3 Answers

Patrick Donahue
Patrick Donahue
9,523 Points

This forum post should help.

This is my answer when I redid the challenge:

float real_numbers[5];
printf("Array real_numbers is %ld bytes.\n", sizeof(real_numbers));
printf("Array real_numbers can store %ld items.\n", sizeof(real_numbers)/sizeof(int));

Thank you, when I did it before doing the division it never told me why it was wrong also. I appreciate your help, the video before it never told me that I needed to use a int to get the answer, but whatever works thanks again. I'm now learning this whole Objective-C stuff.

Patrick Donahue
Patrick Donahue
9,523 Points

Good luck! I find Objective C a bit easier than C. But everyone is different. :-)

Thank you! And for my sake I hope you're right lol!