Variable 'i' : undeclared identifier

I'm really confused right now! Can please anyone help me understand the scope of variable, as we can see it's locally initialized variable then why does the complier says it's an uninitialized variable.

1234567891011

int main()
{
for (int i = 0; i < 5; ++i);
cout<<i; // Complier gives error on compilation that i is an undeclared identifier!for (int i = 0; i < 5; ++i){
//Same thing happens for this blocked of code!//I was expecting an increment of i up to 5!
}
cout<<i; // but it says the 'i' guy doesn't exist!
}