Hello everyone I am learning about the declaration of variables in C++.
Now please tell me my mistake here. Why is it bad to declare your variable twice?
int fly = 0; for(int fly = 0; fly < 10; fly++) { cout << "This is a kite flying" << fly << endl: }
forblock creates a new scope.flyafter the loop and you'll see that it's still0.