Programming: Creating a Global Variable (Example)

A global variable is just a variable that is not withing a function. The scope of a variable relates to where the variable is placed in the program. If a variable is placed outside of all functions (including the main function), then that variable is considered global and can be used by any part of the program, even within functions.



Back to blog

Leave a comment

Please note, comments need to be approved before they are published.