CS136 Lecture Notes - Lecture 6: Imperative Programming, Infinite Loop, Sizeof
Document Summary
Input formatting: when c reads in int values, it skips over any whitespaces includes. Reading input: cannot be re-read, the value is lost after read, typically want to store the read value in a variable, in order to refer to it multiple times. Control flow: use to model how programs are executed, always keep track of the program location (current executed line, when a program is run , the program location starts at the beginning of the main function. Types of control flow: function calls. When function is called, the program location jumps to the start of the function. Return control flow: return back the to location which the function is called, conditions (if statements) Syntax of if is: if (expression) statement. The statement is only executed if the expression is true. Only affects whether the next statement is executed. Can have a sequence of statement in place.