Chapter
Basic I/O
From ComputerScienceOne by Dr Chris Bourke
Concepts
- Why does integer division truncate fractional results in C?
"10 / 20, the result is not 0.5 as expected. The number 0.5 is a floating point number. As such, the fractional part gets truncated (cut off and thrown out) leaving only zero. In the code above, d = a
- How does scanf() read integer, character, and floating-point input in C?
"15.5. Basic I/O The standard I/O library (stdio.h) contains many functions that facilitate input and output including printf() for standard output and scanf() (scan formatted input) for standard inpu