Correct me if I am wrong, but in the function "doub", a new variable scope is entered, correct? I am interested in knowing how C++ determines the stack location of "x". When it swaps to the new variable scope, does it take note its "distance" from the other variable scopes in case it has to call a local variable from a different scope or what?
int main()
{
int x;
int doub()
{
return 2*x;
}
return 0;
}