I write the following code:
#include <iostream>
using namespace std;
int main() {
unsigned int i=1;
i=i-3;
cout<<i;
return 0;
}
The output is a garbage value, which is understandable.
Now I write the following code:
#include <iostream>
using namespace std;
int main() {
unsigned int i=1;
i=i-3;
i=i+5;
cout<<i;
return 0;
}
Now the output is 3. What's happening here? How is the garbage value being added by 5 here?