By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,193 Members | 826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,193 IT Pros & Developers. It's quick & easy.

global variable

P: 18
what is the difference between local and global variable?
Nov 7 '06 #1
Share this Question
Share on Google+
2 Replies


sonic
P: 40
I am new to C++ so this may not be the best explanation to your question. From my understanding a global variable is one that can be used by the whole program or function; whereas a local variable has a limited scope. A local variable does not share with the whole program.

Again, this my not be the best explanation, but as members here have helped me, I wish to try and do the same for others.
Nov 7 '06 #2

P: 6
Global variables are stored in data segment of memory whereas local variables are stored in stack memory.

~David
Nov 7 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.