Mega Code Archive

 
Categories / C / Code Snippets
 

Use ternary operator in printf

#include <stdio.h> int main(void) { int j = 8, k = 16; printf("Max of %d and %d is: %d\n", j, k, (j>k ? j : k)); return 0; }