Local variables:
Scope: Within a function (including parameter {except for special formal parameters}) or within a code block
Definition: Inside a function, including formal parameters, within a code block
Life cycle: Allocates memory from the defined line until the end of the last line within the code block it belongs to or the end of the return
Storage location: Local variables stored in the stack that are automatically freed when the scope ends
Note: Different scopes can define the same local variable, otherwise it is not possible. Uninitialized defaults are random values (garbage values)
Global variables:
Scope: outside a function or block of code
Life cycle: Starts from the defined line until the end of the last line of the owning program
Storage location: Static Storage Area
Note: If a function has local variables named the same as the global variable, then the nearest principle
Multiple variables with the same name point to the same storage space. Uninitialized defaults to 0
Global variables and local variables---C