Advertisement
Sinux1

3/31/16 slide 19 and 20

Mar 31st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. slide 19 global
  2.  
  3. any line of code below a declared variable , within the same curly braces, can modify that variable.
  4.  
  5. Global variables are bad. All functions can modify it. A Global variable sits outside of all functions.
  6. Global Variables are bad.
  7.  
  8. Local variables are best. Local variables exist within and only within the functions they are declared in.
  9.  
  10. There are static variables - variables that are not destroyed after the function ends.
  11.  
  12. slide 20
  13.  
  14. Static variables are always initialized to 0 by default, unless otherwise initialized.
  15. Only initialized once.
  16. Whatever its value at the end of function, is its value when the function is called again.
  17. STATIC VARIABLE LIVES OUTSIDE OF FUNCTION BUT CAN ONLY BE ACCESSED FROM WITHIN FUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement