Q:

multiple logic operators in c

Alright, so how "nice" does C play with using multiple logic operators in one if statement? For example, if I want to compare two points, to see if one is adjacent to the other, would it work to use if(X1 == X2 && Y1-- == Y2 || Y1++ == Y2 || Y1 == Y2 && X1-- == X2 || X1++ == X2) or do I need to break it up into 4 else if statements?

A:

You can absolutely use the way you are doing as long as you use () properly to determine which conditions are the part of the outer parathenses and which one is the part of the inner one. For instance, assuming your condition is true only if X1 == X2 and Y1-- == Y2 || Y1++ == Y2 || Y1 == Y2 and X1-- == X2 || X1++ == X2. then use parathenses properly, like this:
if( (X1 == X2) && (Y1-- == Y2 || Y1++ == Y2 || Y1 == Y2) && (X1-- == X2 || X1++ == X2) )

This condition without parentheses makes it very complicated to understand, and you are likely to make an error.

