printf("%f A ball with a radius of 14.5 inches.");
How do I correct this? I am trying to write a print function(Still pretty green when it comes to C) I am not sure how to correct it.
You may or may not be receiving a compilation warning with this because you are calling printf, have a specifier in your format, but do not provide a value. "%f" expects for you to pass a float value to it. The following:
printf("A ball with radius of %f inches.", 14.5f);
should work, if that is what you are looking to do. If it is, you might need to augment the %f
to adjust for precision (something like "%.1f"
).
Otherwise if you actually want to print the %f outright try this:
printf("%%f A ball with a radius of 14.5 inches.");
Happy coding!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.