CS136 Lecture Notes - Lecture 8: Call Stack, Memory Address, Local Variable

179 views4 pages

Document Summary

All local variables (both constants & mutable variables) > only reserved when program is called. The return address: pass by value, memory address is always 8 bytes, parameters & local variables both count + memory address for space allocation (call stack ) Recursion: each recursive call is simply a new stack frame with a separate fram of reference. Stack section: the fourth section, highest available memory address. 1: each additional grows up with smaller memory space. Uninitialized memory: mutable variables should be initialized, global. Automatically initialize the variable to be 0. Good style to explicitly initialize a global variable to 0: local. Uninitialized local variable has an arbitrary initial value: memory snapshot1. Uninitialized local variables (???: inside of a loop. Each times a definition is reached, re-initialize variable. Tuesday, january 30, 2018: (&) produce the location of an identifier, printf ( %p , &g) Pointers: type for storing an address, (*) star before the identifier.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents