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 trialAdi Jain
2,771 PointsWhat am supposed to do the "x" part is throwing me off.
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.
1 Answer
Jake Adams
1,608 PointsYou need to replace 'x' with the actual size of the array (in bytes). You will need to use the formatting options available in the printf
function call. You can read about that here
printf("Array real_numbers is %ld bytes");
That's the first part. %ld
is a placeholder to let C know we are going to put a long, signed integer there (see link above for descriptions of the placeholders).
The second part is to pass printf
the value that we want to put in that placeholder. printf
takes any number of arguments. The first argument that you see above is the message format. All arguments that follow correspond to any placeholders that we have in the message format.
printf("Array real_numbers is %ld bytes", sizeof(real_numbers));
Hope that helps!
Adi Jain
2,771 PointsThank You Jake, sorry for not responding faster I had accidentally divided the size of real numbers by float, so that is what was messing me up.
Jake Adams
1,608 PointsJake Adams
1,608 PointsWhat code do you have so far? If you share it here, I can help out