CISC 101 Lecture Notes - Lecture 22: Local Variable, Global Variable

59 views2 pages

Document Summary

Variable scope is the block of code in which you can access it (x) local variable if deined inside a piece of code. Local scope! (x) global variable if deined outside of code. Fun2() >> 5 then error because b wasn"t deined. 8 calling a funcion wouldn"t mater because it looks at the local variable. The period of ime that a variable exists is called its lifeime. Local variables are automaically created when a funcion is called and destroyed when the funcion terminates. Thus the values of local variables are not retained from one funcion call to the next. What if you need a variable that is visible and will survive. A global variable is a variable that is deined outside of any funcion deiniion. A global variable is available to any funcion. Syntax error is a problem with how you wrote a line a code, before it runs.

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