+ 4
How a conditional operator works???
(a<b?a:b)
3 Answers
+ 33
int x = (a <b ) ? a : b ;
//x will be the number which is smaller ,
//if a is smaller than b , then x will be a ... else b //even if a = b , then also x will be b
+ 6
The a<b is the condition. If it is true then the result will be the first one which is a, otherwise th result will be b.
+ 4
condition ? statement if condition is true : statement if condition is false