what is a global variable? is that when the variables are located outside of int ()??

Recommended Answers

All 2 Replies

Global variables are variables that are declared outside a function, meaning that they can be accessed anywhere in the program by any function. Any variable declared outside of int main() is a global variable. Using global variables is not good programming technique, although it can be done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.