* przemek drochomirecki:
why the outcome of the following code is undefinied?
int c=0; cout<<c++<<c;
Well, technically it isn't properly undefined until the next revision
of the standard. As it is the standard's examples are inconsistent
with the normative text, which therefore has some shadow of doubt
hanging over it. But in practice the consensus is that it's
undefined, and the reason is that 'c' is modified and used with no
intervening sequence point; a sequence point is a point where all
computations specified before the point are guaranteed to have finished.
You can do
cout << c++;
cout << c;
but better,
cout << c;
++c;
cout << c;
See <url:
http://home.no.net/dubjai/win32cpptut/html/w32cpptut_01_02_11.html>.