Assume that x is 11, y is 6, and z is 1 at the beginning of each statement.
w=x-- + y --*++z
The answer is 23, but i cant figure out whats going on there. what is ++ and what --?
2. !!(x*4)+x%y
answer is 6, and again idk whats going on
Assume that x is 11, y is 6, and z is 1 at the beginning of each statement.
w=x-- + y --*++z
The answer is 23, but i cant figure out whats going on there. what is ++ and what --?
2. !!(x*4)+x%y
answer is 6, and again idk whats going on
The value of x-- is the value of x
the value of y-- is the value of y
the value of ++z is 1 more than the value of z
so, in w = x-- + y -- * ++z; you can replace the expressions by their values
w = 11 + 6 * 2
w = 11 + 12
w = 23
~~~~~~~~
The logical negation operator (!) yields a value of 0 or 1
!!(WHATEVER) is 0 or 1
it is 0 if WHATEVER is 0; it is 1 otherwise
All the logical operators (&& (AND), || (OR), == (EQUALITY), etc) yield either 0 or 1.
Your description of why the value is 0 is correct.
But there may be short-circuit evaluation in different expressions. Just remember that not all sub-expressions need to be evaluated to get the final result
The statement
x = ((4 == 4) || (format_hard_disk()));
will never call the function format_hard_disk() because its value is not needed to determine the final value to assign to x.
You know that the first equal sign,because it is single it is used for assignment and not for comparison.Code:w=x==y
And yes false || false = false .Because of boolean algebra false is 0 and true is 1.