Click to edit Master title style
1
Operator in c
N a m e : S u b h r a s i s B i s wa l
R e g d . n o : 2 2 0 3 0 11 2 0 1 6 8
Click to edit Master title style
2
content:-
1.Operator
2.Types of operator:-
*Arithmetic operator
*Assignment operator
*Increment and decrement operator
*Relational operator
*Logical operator
*Conditional operator
*Bitwise operator
*Binary operator 2
Click to edit Master title style
3
Operator
C operator are one of the features in C which
has symbols that can be used to perform
mathematical, relational, bitwise, conditional
or logical manipulations.
The C programing language has a lot of built-
in operators to perform various tasks as per
the need of the program.
An operator in C is a symbol or a keyword that
performs a specific operation on one or more
operands.
3
Click to edit Master title style
4
Operator Description Example
+ Adds two
operands
a + b=30
- Subtracts
second
operand
from the first
a – b=10
* Multiplies
both
operands
a * b=200
/ Divides
numerator
by de
numerator
b/a=2
Arithmetic operator:-
An arithmetic operator performs
mathematical operations such as addition,
subtraction, multiplication, division etc. on
numerical values (constants and variables).
These operators can be used to perform
simple or complex calculations in various
programming languages and applications.
Click to edit Master title style
5
Assignment operator:-
 The assignment operator is a assigns
the value of its righthand operand to a
variable, a property, or an indexer
element given its left hand operand .
 The result of an assignment expression
is the value assigned to the left-hand
operand.
Operator Operation performed
%= Reminder assignment
+= Addition assignment
-= Subtraction assignment
<<= Left-shift assignment
Click to edit Master title style
6
Increment and decrement operators:-
 The increment operator increases the
value of the variable by one and the
decrement operator decreases the value
f the variable by one.
 The increment (++) and decrement (- -)
are important unary operators in c. unary
operators are those which are applied on
a single operand.
operator Expression Description
++ ++X Pre-increment
X++ Post-increment
-- --X Pre-decrement
X-- Post-decrement
Click to edit Master title style
7
Relational operator:-
 A relational operator checks the relationship
between two operands. If the relation is true, it
returns 1; if the relation is false, it returns
value 0. Relational operators are used in
decision making and loops.
Operator Meaning of
operator
Example
== Equal to 5==3 is
evaluated to 0
> Greater than 5>3 is
evaluated to 1
< Less than 5<3 is
evaluated to 0
!= Not equal to 5!=3 is
evaluated to 1
Click to edit Master title style
8
Logical operator :-
 We use logical operators to perform various
logical operations on any set of given
expression.
 We have three major logical operators in the c
language –Logical NOT(!),Logical OR(||) and
Logical AND (&&).
operator description Example
&& Called Logical AND
operator. If both the
operands are non-
zero, then the
condition becomes
true.
(A && B) is false
|| called Logical OR
Operator. If any of
the two operands is
non-zero, then the
condition becomes
true.
(A || B) is true
! Called Logical NOT
Operator. It is used
to reverse the
logical state of its
operand. If a
condition is true,
then Logical NOT
operator will make it
false.
! (A && B) is true
Click to edit Master title style
9
Conditional operator:-
 A conditional operator is a single
programming statement, while the ‘if-else’
statement is a programming block in which
statements come under the parenthesis.
 A conditional operator can also be used for
assigning a value to the variable, where as
the ‘if-else’ statement cannot be used for
the assignment purpose.
operation description Example
Equal to == If(a==0)
b=b+5;
Not equal to != If(a!=1)
b=b+4;
Click to edit Master title style
10
Bitwise operator:-
 The Bitwise Operator in C is a type of
operator that operates on bit arrays, bit
strings, and tweaking binary values with
individual bits at the bit level.
 It is mainly used in numerical
computations for a faster calculation
because it consists of two digits – 1 or 0.
operator description
& Bitwise AND
| Bitwise OR
~ One’s complement
<< Left sift
>> Right sift
^ Bitwise XOR
Click to edit Master title style
11
Binary operator:-
 A Binary operator is an operator that operates on two operands to produce a new
value .
 Most common binary operators are +, -, *, /, etc. Binary operators in C are further
divided into - Arithmetic Operators.
Click to edit Master title style
12

operator (1).pptx

  • 1.
    Click to editMaster title style 1 Operator in c N a m e : S u b h r a s i s B i s wa l R e g d . n o : 2 2 0 3 0 11 2 0 1 6 8
  • 2.
    Click to editMaster title style 2 content:- 1.Operator 2.Types of operator:- *Arithmetic operator *Assignment operator *Increment and decrement operator *Relational operator *Logical operator *Conditional operator *Bitwise operator *Binary operator 2
  • 3.
    Click to editMaster title style 3 Operator C operator are one of the features in C which has symbols that can be used to perform mathematical, relational, bitwise, conditional or logical manipulations. The C programing language has a lot of built- in operators to perform various tasks as per the need of the program. An operator in C is a symbol or a keyword that performs a specific operation on one or more operands. 3
  • 4.
    Click to editMaster title style 4 Operator Description Example + Adds two operands a + b=30 - Subtracts second operand from the first a – b=10 * Multiplies both operands a * b=200 / Divides numerator by de numerator b/a=2 Arithmetic operator:- An arithmetic operator performs mathematical operations such as addition, subtraction, multiplication, division etc. on numerical values (constants and variables). These operators can be used to perform simple or complex calculations in various programming languages and applications.
  • 5.
    Click to editMaster title style 5 Assignment operator:-  The assignment operator is a assigns the value of its righthand operand to a variable, a property, or an indexer element given its left hand operand .  The result of an assignment expression is the value assigned to the left-hand operand. Operator Operation performed %= Reminder assignment += Addition assignment -= Subtraction assignment <<= Left-shift assignment
  • 6.
    Click to editMaster title style 6 Increment and decrement operators:-  The increment operator increases the value of the variable by one and the decrement operator decreases the value f the variable by one.  The increment (++) and decrement (- -) are important unary operators in c. unary operators are those which are applied on a single operand. operator Expression Description ++ ++X Pre-increment X++ Post-increment -- --X Pre-decrement X-- Post-decrement
  • 7.
    Click to editMaster title style 7 Relational operator:-  A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. Relational operators are used in decision making and loops. Operator Meaning of operator Example == Equal to 5==3 is evaluated to 0 > Greater than 5>3 is evaluated to 1 < Less than 5<3 is evaluated to 0 != Not equal to 5!=3 is evaluated to 1
  • 8.
    Click to editMaster title style 8 Logical operator :-  We use logical operators to perform various logical operations on any set of given expression.  We have three major logical operators in the c language –Logical NOT(!),Logical OR(||) and Logical AND (&&). operator description Example && Called Logical AND operator. If both the operands are non- zero, then the condition becomes true. (A && B) is false || called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true. (A || B) is true ! Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false. ! (A && B) is true
  • 9.
    Click to editMaster title style 9 Conditional operator:-  A conditional operator is a single programming statement, while the ‘if-else’ statement is a programming block in which statements come under the parenthesis.  A conditional operator can also be used for assigning a value to the variable, where as the ‘if-else’ statement cannot be used for the assignment purpose. operation description Example Equal to == If(a==0) b=b+5; Not equal to != If(a!=1) b=b+4;
  • 10.
    Click to editMaster title style 10 Bitwise operator:-  The Bitwise Operator in C is a type of operator that operates on bit arrays, bit strings, and tweaking binary values with individual bits at the bit level.  It is mainly used in numerical computations for a faster calculation because it consists of two digits – 1 or 0. operator description & Bitwise AND | Bitwise OR ~ One’s complement << Left sift >> Right sift ^ Bitwise XOR
  • 11.
    Click to editMaster title style 11 Binary operator:-  A Binary operator is an operator that operates on two operands to produce a new value .  Most common binary operators are +, -, *, /, etc. Binary operators in C are further divided into - Arithmetic Operators.
  • 12.
    Click to editMaster title style 12