Differences between local and global variables

advertisements

I am looking for some guidance on the difference between a global scope variable and a local scope variable. Thanks.


Global variable - declared at the start of the program, their global scope means they can be used in any procedure or subroutine in the program.

Local variable - declared within subroutines or programming blocks, their local scope means they can only be used within the subroutine or program block they were declared in.

Resource: Fundamentals of Programming: Global and Local Variables

Resource: Difference Between Local and Global Variables