@maxdancona,
maxdancona wrote:The '&&' operator is a boolean operator (C doesn't have boolean data types), so is the '||' operator. A boolean is a value that is restricted to either "true" or "false". In C any number that is not 0 is true (although 0 and 1 are generally used as false and true).
Almost totally correct, except... C
does in fact have a boolean data type, which from memory I believe was introduced in the C99 revision, so you're wrong about that. If you don't include the "stdbool.h" header, then you couldn't write "bool result = <value>" nor the actual words "true" or "false" in your code - you'd have to use "_Bool result = <value>" and "0" instead "false" and "1" instead of "true" (being the reason I did include the "stdbool.h" header).
maxdancona wrote:The && is the logical conjunction operator in C. It is only "True" if both of the operands are "True"
It's actually called the "logical AND operator" AFAIK.
maxdancona wrote:The "||" is the logical disjunction operator. It is "True" is either of the operands are true (i.e. only "False" when both operands are false).
It's actually called the "logical OR operator" AFAIK.
maxdancona wrote:So you can name the two operands whatever you want. The operator works the same way. if "fish" is true and "chips" is false... fish && chips will be false.
Actually, and while both the logical AND operator and the logical OR operator work in a similar way, they don't work in
exactly the same way - as there wouldn't be any point in having two different operators that worked in the same way, as this would imply they do the same thing, well, not quite. So that statement of your's is not quite true.
maxdancona wrote:Does that explain it to you? (When you learn about floats... it is going to blow your mind).
I already knew how those C operators work and what they do. I also already know what "float" and "double" variables are. Why would you assume I only know integers?
More to the point: while you've finally looked up the logical AND, and the logical OR operators and learnt what they do... you still haven't understood the point of the exercise.
Hint: why would you think that "short int left = 1, right = 0;" are defines, defining "true" or "false" when they are both integer variables assigning "1" and "0" to "left" and "right" respectively?