I came across this code in which a variable is assigned to itself for no good reason.
double x = x = (a - b) / (c - 1);
It is not making much sense to me. Is there a reason behind this?
When assigning multiple variables at once all the variables will get the value of the right hand operand. Doing this double assignment does not provide any value, it will probably even be optimzed to double x = (a - b) / (c - 1);
by the compiler. This is definately a typo.
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