Hi guys,
I have this chunk of code:
...
int x = 10; // global
void main() {
int x = 20; (line A)
{
int x = 30;
// How to read the value of x from the line A in this scope?
}
}
...
int x = 10; // global
void main() {
int x = 20; (line A)
{
int x = 30;
// How to read the value of x from the line A in this scope?
}
}
To copy to clipboard, switch view to plain text mode
The question is in the code: How to read the value of x from the line A in this scope?
cout << x ; // gives 30;
cout<<::x; // give 10;
cout << x ; // gives 30;
cout<<::x; // give 10;
To copy to clipboard, switch view to plain text mode
Thanks for any help
Kacper
Bookmarks