------------------------------------------------------------------------------
MC logo
Problems With C I/O
[^] Code Examples
------------------------------------------------------------------------------
<<An Average Example Average in C++>>
The type and number of % constructs must agree with the arguments given.

For scanf, you must get & in the right places.

Generally, compilers cannot check this.
At most a warning.

Extra arguments are just ignored.

Extra % specifications apply to junk following the arguments.

Extra % specifications in scanf use that junk as memory addresses.

Type mis-match can be very interesting.

Typically leads to run errors with opaque messages.

Reading: Ch. 4; pp. 264-270
<<An Average Example Average in C++>>