====================================== Notes for Lecture 3 - January 22, 2008 ====================================== Demos and discussion of several programs: * Programming practice ** printf, scanf, formats ** format codes %i, %g, %lg ** puts ** scanf response to bad user input and return value ** data validation; avoidance of garbage output ** preprocessor: #include, #define ** floating point and integer operations ** assignment operator = ** comparison operator == ** arithmetic operators +, -, *, /, % ** compound assignment operators +=, /=, %=, ++x ** if, else, while, for(;;) control statements ** int main(void) and return value * Algorithms ** finding length of binary representation ** base conversion * Concept of number representation ** an integer is an abstract mathematical entity ** an int represents certain integers as bits in a computer We think of operating on integers, but the machine manipulates bits to give that illusion.