Lab 14
Variable Scope and Lifetime
- GR 1 Review
CS211 Lab Policy:
- This lab exercise will not be graded.
- Submit as much as you have completed before the end of the lab period in
which it is assigned.
- If you do not finish this lab work, it is to your advantage to finish it
outside of class. Please re-submit your finished work to the course web
site.
- You may received help from anyone in completing this lab.
- You may not submit another student's code as part of your
lab.
Instructions:
To reinforce the ideas in lesson 14:
- Save the file
global_demo.m
to your CS211 programs folder.
Examine the code until you understand what it is doing.
Execute the code and understand what its output means -- that passing large
arrays as arguments is time consuming.
- Save the file
Persistent_Demo.m
to your CS211 programs folder.
Examine the code until you understand what it is doing.
Execute the code and understand what its output means -- that persistent
variables retain their value from one function call to the next.
- Save the file
Local_variable_demo.m
to your CS211 programs folder.
Examine the code until you understand what it is doing.
Execute the code and understand what its output means -- that local
variables are created and destroyed on each new call to a function.
Prepare for the GR 1, which is next lesson:
Turn-in:
(none)