Long term information (memory) and short term information (memory):
|
A Java program can define 4 kinds of variables:
Each kind of variables has is own scoping rules and life time
A C program can define 5 kinds of variables:
Each kind of variables has is own scoping rules and life time
Local variables and parameter variables are defined inside a function definition:
Local variables and parameter variables store short term information
Local variables and parameter variables are only accessible inside their own function
Global variables are defined outside all function definitions:
Global variables store long term information
Global variables are only accessible by all function
Static local variables are defined inside a function using the keyword static:
Static local variables store long term information
Static local variables are only accessible inside their own function
Static global variables are defined outside all function definitions with keyword static:
Static global variables store long term information
Static global variables are only accessible by functions inside their own program file