Integers and Floats
- Look at the picture on page 90.
- Char as an integer type should be surprising?
- Where is string on this list?
- Integers
- An integer between INT_MIN and INT_MAX.
- Look at /usr/include/limits.h
- There are actually four integer types + 1.
- There is no given size, just a relationship among the types.
- There is also unsigned.
- Char is strange in that I/O uses the ASCII table.
- Others this is not the case.
- I/O
- Output as normal
- Input:
- read optional +/-
- read digits until a non digit is found
- If no digits are found go into an error state.
- And the value of the variable is not changed.
- Basic Operations:
- +,-
- *
- /
- %
- ++, --
- prefix operators
- postfix operators
- Errors: Overflow
- Floats are used to represent real numbers.
- float, double, long double
- Floats are numbers in scientific notation.
- IEEE 754 standard
- Same operations, but not %
- Gap and precision.