0
C language
What does the ?: mean in here CMP(A,B) ((A)>(B))?1:((A)<(B))?-1:0
1 Answer
+ 8
Check out the third lesson in this link.
https://www.sololearn.com/learn/C/2923/
The one on Conditional Expressions
y = (x >= 5) ? 5 : x;
/* This is equivalent to:
if (x >= 5)
y = 5;
else
y = x;
*/
What your example doesâ˘: it is a nested conditional expression which returns
1 if A > B
-1 if A < B
0 if A == B