Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPaul Chen
178 PointsSo far I had only understood the first few lessons but when comes to functions and scope, I am so lost.
I don't even know the process and its getting complicated which my mind won't take it in. Is there a way to learn the lessons much easier?
1 Answer
Guillaume Maka
Courses Plus Student 10,224 PointsThink a scope like a closed area, all objects in this area can interact with each other but objects outside the area can't, because they can't see them -> Local scope
int a;
int main(){
int b;
}
"a" can't use "b", because "b" is local variable to the "main" function: local scope
"b" can use "a" because "a" is a global variable to the entire file: global scope.
I think an image would be more appropriate for a better explanation, I'll try to find one and link it to this answer.