(i) Arithmetic Operators
All the basic arithmetic operations can be carried out in C. Example : +, -, %, / , *, &&, etc. Both unary
and binary operations are available in C language. Unary operators operate on a single operand, where
operand can be a constant, a variable or a valid C expression. Binary operators operate on two operands.
Ternary operators operate on three operands.
Unary Operators:
+a (unary plus), -a (unary minus), ++a (pre increment) , !a(logical NOT).
Binary Operators:
a+b (binary addition), a-b(binary subtraction),a*b(multiplication),
a / b (division), a % b (Modulus division), x > = y (relational operator)
Ternary Operator:
This is also called conditional operator ( ? : )
Test expression ? expression 1 : expression 2
Comments
Post a Comment