A random question [SOLVED]

What happens if I do:

1
2
3
4
5
stringstream stream;
stream.clear();
int i = 0;
stream>>i;
cout<<i;


Will i be 0, or will this cause undefined behavior?
Last edited on
The output will be the current value of i (in this case 0)- because the stream is
empty - then stream >> i will fail - so i will not be modified.
Thanks!
Topic archived. No new replies allowed.