Is the following code valid? If so, what is the scope of x?
x
int main() { if (true) int x = 42; }
My intuition says that there i
My Visual studio says that time of life of your variable x is pretty small - just while we are inside operator if, so x vill be destroyed when we are out of if condition, and there is absolutely no meaning to declare variables like this.