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) Fundamentals of C Variables

program error?

i am using a %f format option....

6 Answers

Stone Preston
Stone Preston
42,016 Points

the general form of a printf is

printf("some string to print %x", someVariable);

where %x is a format specifier such as %f or %d.

your code is almost correct. your printf statement is not exactly right. you are missing the quotes around your string, the word inches, as well as the variable at the end. your escape sequence also needs to be \n

float radius = 14.5;

printf("A ball with a radius of %f inches. \n", radius);

you must pay close attention to the challenge instructions, if you dont follow everything exactly as they say to, you wont pass

Stone Preston
Stone Preston
42,016 Points

can you post the full code you are trying to use

I'm trying to post the screenshot....cant figure out where to add it

Stone Preston
Stone Preston
42,016 Points

you can just copy and paste the code if you want, its a bit easier to do. to post an image you must upload it to an image host like imgur, then copy the url into a markdown tag like so:

![some image alt text](https://imgur.com/pathtoimage "some title")

the image alt text and the title at the end can be whatever you want.

gunthersnaps.com/screenshot/01.png

thank you, i was completely confused with the error code it was returning me. i thought it was telling me to change the "%f" to "%f"

i failed to examine the code itself as i was trying to fix the %f part....if that makes any sense. thank you thank you!

Stone Preston
Stone Preston
42,016 Points

sometimes the errors the challenge gives you dont make much sense. sometimes it cant determine what you did wrong, so the error it provides isnt very helpful

well now that i know that, i think it will be easier to understand this websites advise :)