CMPT 225 Lecture Notes - Include Directive, Console Application, Call Stack
Document Summary
Template class: class you write, can use to work with any time, very useful for data structures. Most of what we write in this course will be templated. Static: used for global vars (can access from anywhere in program, they are bad, unless constants), when execute program w/ series of global vars, know exactly how much memory needed to store. Must be reserved space through lifetime of program. Automatic: used for variables declared in functions (at least most of them). Call stack is mechanism for managing automatic memory. Have function, starts of declaring things, those variables stored in automatic memory. Call stack starts at some address in mm, hit first var (x), reserve 4 bytes of space. Next var (y), reserve 4 bytes of space immediately after first (x). main () { int x; int y; f1(x); int z = f2(); f1(); void f1(int a) { double d; int f2( ) { int arr[10]; return 13;