How to use short-form if (conditional ternary operator) in C

1 Answer

0 votes
#include <stdio.h> 
 
int main(void)
{   
    int a = 12, b = 20;
 
    int c = (a > b) ? a : b;
 
    printf("%d\n", c);
      
    return 0;
}
 
  
/*
run:
    
20
 
*/

 



answered May 27, 2017 by avibootz

Related questions

2 answers 317 views
2 answers 324 views
1 answer 229 views
1 answer 261 views
...