0

C language

What does the ?: mean in here CMP(A,B) ((A)>(B))?1:((A)<(B))?-1:0

17th Feb 2019, 3:42 AM
►BornToBeProgrammer✍✌◄
►BornToBeProgrammer✍✌◄ - avatar
1 Réponse
+ 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
17th Feb 2019, 4:27 AM
Louis
Louis - avatar