Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What are global variables? How are they declared? What are the problems with using globals?

user-image
Question added by Rizwan Shah , Project Manager , COMSATS IIT
Date Posted: 2014/09/30

Global variables are the variables which are declared outside the main function in c++.

Local variable are the variables which are declared within method().These variables can be accessed within which they are declared

Global variables can be accessed anywhere within the program.

Local variables which are declared with the same name as Global variables hides the Global variables.

Therefore wastage of memory.

More Questions Like This