#Boolean operators in for loops

4 messages · Page 1 of 1 (latest)

modern questBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

torpid sedge
#

int i = 5, j = 2, k = 4, l = 3, m = 7, n = 8;
for ( i = 1, j = 3, k = 4; i++ < l || ++j < m && k < n; )
cout << i << " " << j << " " << k << " " << l << " " << m << endl;

#

OUTPUT : 2 3 4 6 7
3 3 4 3 7
4 4 4 3 7
5 5 4 3 7
6 6 4 3 7

#

I don't understand why j = 3 on the first line as you are incrementing it