Some programmers prefer to use this:
if (0 == Indx)
because this line
if (Indx == 0)
can be "easily" coded by mistake, like an assignment operator (instead of a comparison)
if (Indx = 0) //assignment, not comparison.
And this is quite true in C.
Indx = 0 is an expression that returns 0 (which also assigns 0 Indx).
As mentioned in the comments on this answer, most modern compilers will show you warnings if you have such a task inside if if.
You can learn more about the advantages and disadvantages here .
source share