As
ppolymorphe pointed out, that is a subtlety of the
C
programming language ('inherited' by
C++
:-) ).
If you break the offending line
Quote:
cout <<*p<<","<<**q<<","<<*t++;
in two ones
cout << *p << "," << **q << ",";
cout << *t++;
then you get the output you expect.
That happens because the order of evaluation of the items feeding
cout
is not predictable (see, for instance
Order of evaluation - cppreference.com[
^]).