CSC209H1 Lecture Notes - Lecture 5: C Dynamic Memory Allocation, String Literal, Call Stack

68 views5 pages
14 Dec 2016
School
Course
Professor

Document Summary

Memory is divided into different memory segments. Both constants and globals are referred to as globals. Allocated when we enter a function, deallocated when the function returns. Called automatic memory because the memory is released automatically. These are variables that are stored on the stack. When a variable is declared outside of a function. It will exist in the same address space through the entire program while it is running. Visible to all functions in the program. When a variable is declared static, it is placed into the globals area of the memory, instead of into the stack. A static variable inside a function keeps its value between invocations, but unlike global variables, is invisible to other functions. We cannot update" any constant, once it is declared, that is the value that it will always be char *cards = jqk ; When the computer loads the program into memory, it puts all of the constant values.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents