i think it is related to using type conversion operators

the following code prints like:
98 a
99 b
.
.
.
.
123 z
what is the problem with the code, please answer?

int main()
{

int iii = 97;
while (iii <= 122)
{
cout << iii << "t" << (char)iii++ << endl;

}

return 0;

}
> what is the problem with the code

cout << iii << "t" << (char)iii++ << endl; engenders undefined behaviour.

2) If a side effect on a scalar object is unsequenced relative to a value computation using the value of the same scalar object, the behavior is undefined.
1
2
cout << i << i++; // undefined behavior
a[i] = i++; // undefined bevahior 

http://en.cppreference.com/w/cpp/language/eval_order
k.got it....
there were other mistakes also in the code, now i sorted all out.
thanx....
Topic archived. No new replies allowed.