5.introduction To Oprators in C-Programming PDF
5.introduction To Oprators in C-Programming PDF
5.introduction To Oprators in C-Programming PDF
Parne
Assistant Professor,
CoED, SVNIT Surat.
Introduction
Operator: A symbol that tells the computer to perform certain
mathematical or logical manipulations.
C offers rich set of built-in operators
Arithmetic
Relational
Logical
Assignment
Increment and Decrement
Conditional
Bitwise
Special
Expression: Sequence of operators and operands that reduces to a single
value
E.g. 10+15
CLASSIFICATION:OPERATORS IN C
ARITHMETIC OPERATOR:
There are three types of arithmetic operators in C:binary,unary,
and ternary.
Binary operators: C provides five basic arithmetic binary
operators.
Arithmetic binary operators:
Arithmetic Operators
Operator Meaning
* Multiplication
Operator Meaning
&& Logical AND
|| Logical OR
! Logical NOT
LOGICAL OPERATORS :
C provides three logical operators for forming logical
expressions. Like the relational operators, logical operators
evaluate to 1 or 0.
Logical negation is a unary operator that negates the logical value of its
single operand. If its operand is non-zero, it produces 0, and if it is 0, it
produces 1.
Logical AND produces 0 if one or both its operands evaluate to 0.
Otherwise, it produces 1.
Logical OR produces 0 if both its operands evaluate to 0. Otherwise, it
produces 1.
n=sizeof(long int);
k=sizeof(235L);
COMMA OPERATOR :
This operator allows the evaluation of multiple expressions,
separated by the comma, from left to right in order and the
evaluated value of the rightmost expression is accepted as
the final result. The general form of an expression using a
comma operator is
Expression M = (expression1, expression2, …,expression N);
where the expressions are evaluated strictly from left to right
and their values discarded, except for the last one, whose
type and value determine the result of the overall expression.