ECS 30 Lecture Notes - Lecture 20: Static Variable, Memory Management, Null Pointer

26 views2 pages
Lecture 20
Static memory allocation
Life time issue
- Function cannot return a local variable
- When using local variable, all resources have to already exit before calling subfunction
- Global variable exist during the entire programs’ execution even when unused
Code lines examples:
Sizing issue
What if we need more ..
Requirement
- Lifetime independent from function
o Not in the stack
- Lifetime not necessarily for the entire
programs execution
o Not in data segment
Dynamic memory allocation
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

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