EECS 280 Lecture Notes - Lecture 13: Local Variable, Stack Overflow

32 views2 pages

Document Summary

There are two types of variables: local variables and global variables. An object is a piece of data in memory. An object lives at an address in memory. You can use an object during its lifetime. Local variables live during the execution of a local block. Static variables come alive in the beginning of the program, they come alive for the duration and then they don"t. Don"t point a pointer to a local variable if the variable is going to go away but the pointer isn"t - can cause a lot of problems because the pointer will start pointing at something that isn"t there. We create dynamic variables by using new, and then delete. The difference between a dynamic variable and a local variable is that dynamic variable don"t go out of scope after the function is executed; they are erased after the delete function is used. Nullputr = changes the value of a pointer to be zero.

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