Computer Science, asked by Anonymous, 1 year ago

What is ternary operator in c?

Today is my exam
wish me good luck​


Anonymous: hello
Anonymous: no exam today
Anonymous: because today is a festival

Answers

Answered by Anonymous
4

Ternary operator is used as a conditional operator.

They are easier to use than if else if

Answered by siddhartharao77
8

Short notes on Ternary Operator:

(i) Ternary operator works like if-then-else statement.

(ii) It is also called as conditional operator.

(iii) It requires three arguments. If the expression is true, then it evaluates true then true statement is executed else false statement is executed.

Syntax:

condition?true?false

Example:

int a = 10, b = 15;

a > b ? printf("a is greater") : printf("b is greater");

Advantages:

(i) code redundancy

(ii) Improves the performance

************** Wish U All The Very Best ***********************


Anonymous: yes
Swetha02: Sare
siddhartharao77: Ikada chat cheyodhu please!.
Anonymous: im also not able to comment in other languages
siddhartharao77: We can type in any language in comment section.
siddhartharao77: Check you inbox!
Similar questions