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 trialahmed saleh
2,754 Pointsthe function cant see the variables in main code?!!
hi as i know from programming languages , that the variables out side functions are global so you cant access them like this
int a = 10;
int count (){
cout<<a<<endl;
}
it can access it ?? is the rules in php not same?!
1 Answer
shawn stokes
5,651 Pointsit can if you tell it to look for a global variable. or require it as an argument in the function.
ahmed saleh
2,754 Pointsahmed saleh
2,754 Pointsthank you