What is Know as a Ternary Operator?

         What is meant by ternary operator with example

In C language the Ternary Operator means Conditional Operator and it takes Three Operand to work hence they are called ternary operator and It is also known as Conditional operator.

In other word the Ternary Operator means we can write the multiple expression in a single line and hence it is called Ternary Operator .

Benefits Of the Ternary Operator :-

  1. It reduced the number of line of code.
  2. It increase the code readability     

Uses of the ternary operator :-

  • It is used for simply remove or replace the if statement.
Representation:-

  • It can be represented with  ? :   
Syntax :-

   Expression1 ? Expression2 : Expression3

1. The first expression is a comparison argument.

2. The second expression is the result upon a true expression.

3. And the last expression is the result upon a false expression.  


->  I will show you the code of the ternary operator.

Comments

Popular posts from this blog

proassignment help backlink data index 41

programming shark backink data index 31

Programming shark backlink data index 67