Output wrt my reasoning should be 0456 but the compiler shows 0415 and I debugged it a little and realised it is targeting both "i" differently.
I'll be grateful if someone can explain the reasoning behind it. Thank You :)
#include <iostream>
using namespace std;
int main()
{
static int i;
for(int j = 0; j<2; j++)
{
cout << i++;
static int i = 4;
cout << i++;
}
return 0;
}