There are 3 types of operators in C Program on the basis of the numbers of operators:
Unary Operators:
- The operators that requires only one operands to give the result is known as unary operators.
For example:
- a++;
- ++a;
- --a;
- a--;
- b=-2a; tc.
Binary Operators:
- The operators that requires two operands to give the result is known as binary operators.
- It is not the operation in binary form only🤦♂️.
For example:
- a+b;
- a-b;
- z=x%y; etc.
Ternary Operator:
The operator that requires three operands are known as ternary operators.
The conditional operator is the ternary operator. As it works with three operands.
The three operands are:
The condition
The true part
The false part
Syntax:
Result = condition ? Value_if_true : Value_if_false ;
For Example: large = a>b ? a : b ;
excellent explanation sir
ReplyDeletethank u