summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorDivay Prakash <divayprakash@users.noreply.github.com>2018-09-13 00:23:22 +0530
committerGitHub <noreply@github.com>2018-09-13 00:23:22 +0530
commit7989696adb5dceb44a5bd8eb392bc23a575d3d57 (patch)
treee8c905cb8fc5ef0c40154793756b7c89014e6651 /c.html.markdown
parentd5e97c1ceb91446f9b5b8398d81afa95c83a80c1 (diff)
parent70f896eed7d3a3733ebcdf2fd280a7ffa660304b (diff)
Merge pull request #3216 from divayprakash/fix-printf
Fix printf, closes #2730
Diffstat (limited to 'c.html.markdown')
-rw-r--r--c.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 2d54560b..bf93dcf5 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -388,8 +388,8 @@ int main (int argc, char** argv)
// 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.
- printf("%f\n", (float)100); // %f formats a float
- printf("%lf\n", (double)100); // %lf formats a double
+ printf("%f\n", (double) 100); // %f always formats a double...
+ printf("%f\n", (float) 100); // ...even with a float.
printf("%d\n", (char)100.0);
///////////////////////////////////////