mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Fix printf, closes #2730
This commit is contained in:
parent
d5e97c1ceb
commit
70f896eed7
@ -388,8 +388,8 @@ int main (int argc, char** argv)
|
|||||||
// respectively, use the CHAR_MAX, SCHAR_MAX and UCHAR_MAX macros from <limits.h>
|
// respectively, use the CHAR_MAX, SCHAR_MAX and UCHAR_MAX macros from <limits.h>
|
||||||
|
|
||||||
// Integral types can be cast to floating-point types, and vice-versa.
|
// Integral types can be cast to floating-point types, and vice-versa.
|
||||||
printf("%f\n", (float)100); // %f formats a float
|
printf("%f\n", (double) 100); // %f always formats a double...
|
||||||
printf("%lf\n", (double)100); // %lf formats a double
|
printf("%f\n", (float) 100); // ...even with a float.
|
||||||
printf("%d\n", (char)100.0);
|
printf("%d\n", (char)100.0);
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user