I am looking over some code someone else did and I see this:
if (numDetects == 0) {
Table[Index].minF =
Table[Index].maxF = F;
}
The Table[Index].minF = blank does not make any sense to me. I've never seen this in my life. BUT the code does compile and run, so could someone explain to me if this is possible or not to just have a equal sign left hanging there? Thanks!
Yes; C doesn't care about the white space between the first line and the second, so it sees it as
Table[Index].minF = Table[Index].maxF = F;
It's syntactically equivalent to
Table[Index].minF = (Table[Index].maxF = F);
since the assignment operator =
not only assigns the left-hand side to the right-hand side, but also returns the value that was assigned. In this case, that return value is then in turn assigned to the outer left-hand side.
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