EEVblog® Electronics Community Forum
Electronics => Microcontrollers => Topic started by: Ground_Loop on December 01, 2021, 06:53:25 pm
-
I ran across something similar to this and don't know how to interpret it. A = (B < C) D : E; Of course there were actual numbers and variables, but you get the idea. What is being assigned to A?
-
I think there is a question mark missing.
A = (B < C) ? D : E;
That would be a ternary operator.
Equivalent to..
if (B < C)
A = D;
else
A = E;
-
I was thinking the same, but there is definitely not a question mark. I'll consider it a typo.
-
For sure, the "?" is missing, if you try that syntax it will cause a compiling error.