For loops and multiple variables and conditions.
I am using a for loop to set source and destination indexes to copy items in an array.
for(int src = 0, dst = 8;
src < 8, dst >= 0;
src ++, dst --)
{
arr2[dst] = arr1[src];
}
Something like that anyway.
(AND) || (||)
My question is about the exit conditions. There are two here. src < 8
and dst >= 0
. Are these conditions AND-ed (&&
) or OR-ed (||
).
To further explain, are the conditions evaluated like this:
(src < 8) && (dst >= 0)
Or are they evaluated like this?
(src < 8) || (dst >= 0)
Or is it something else entirely different? I imagine the logical thing to do would be to evaluate one of the two ways I specified above, and not something else.