This is useful because we dont want to have to use a different name for every single variable in a program. Here one x is said to shadow the other.
This code is
fine because the variable y exists until the matching brace, which is at the
end of the program after the cout << y << endl;