Variable Scope is an accessible area / portion for any variable where a variable can be accessed after it has been defined.
There are mainly three types of variables Scopes:
Output: Variable inside the function.
OUTPUT: Hello internet
use the static
keyword when you first declare the variable.
Example:
Output: 0
1
2
Then, each time the function is called, that variable will still have the information it contained from the last time the function was called.