Does a && (b = 5/a)
assign 5/a
to b
(for nonzero a
)?
My friend says it doesn't, but I'm confused why it wouldn't.
Your friend is wrong. For nonzero a
, the statement a && (b = 5/a)
will assign the value 5/a
to b
.
If a == 0
, then the conditional will short circuit and the assignment will not occur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With