if (i > 100)
{
  j = "Big";
}
else
{
  j = "Small";
}
Answer: j = (i > 100) ? "Big" : "Small" ;

The operator used to reduce the if..else statement to a one line statement is called ternary operator. A ternary operator is an operator which requires three variables to operate on.

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

bit set, reset/clear, toggle, xor operator, bitwise shifting, Operator precedence, operator precedence, ternary operator, fprintf, fscanf working principal, printing pointers, scanf string input,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan