2. An operator is a symbol that tells the
computer to perform certain mathematical or
logical manipulations.
These operators are used in programs to
manipulate data and variables.
2
4. Arithmetic operators are used to perform numerical calculations
among the values.
OPERATOR MEANING
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulo Division
4
6. Relational operator are used to compare two operands.
Operands may be variable, constant or expression.
OperatorOperator MeaningMeaning
< Is less than
<= Is less than equal to
> Is greater than
>= Is greater than equal to
== Equal to
!= is not equal to
6
7. #include<stdio.h>
void main()
{
int a, b;
printf(“Enter values for a and b : ");
scanf("%d %d", &a, &b);
printf("n The < value of a is %d", a<b);
printf("n The <= value of a is %d", a<=b);
printf("n The > value of a is %d", a>b);
printf("n The >= value of a is %d", a>=b);
printf("n The == value of a is %d", a==b);
printf("n The != value of a is %d", a!=b);
}
7
8. LOGICAL OPERATORS:
OPERATOR MEANING
&& Logical AND
|| Logical OR
! Logical NOT
These operators are used for testing more than one condition and
making decisions.
'C' has three logical operators they are:
8
10. ASSIGNMENT OPERATORS
Assignment operator are used to assign
the value or an expression or a variable to
another variable.
The syntax is
variablename = expression;
i.g. A=b;
Operators:
== , += , -= , *= , /= , %= , >>= , <<= ,
&= ,
10
11. Increments & decrement operator is also called Unary .
The increment operator (++++) adder on to the variable and
decrement (- -- -) subtract one from the variable. There are
following unary operator
INCREMENT & DECREMENTINCREMENT & DECREMENT
OPERATORSOPERATORS
Operator Meaning
++x++x Pre increment
- -x- -x Pre decrement
x++x++ Post increment
X- -X- - Post decrement
11
12. INCREMENT & DECREMENT OPERATORSINCREMENT & DECREMENT OPERATORS
EXAMPLEEXAMPLE
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter the values for a and b :");
scanf("%d %d", &a, &b);
printf("n The value of c is %d", c=++a);
printf("n The value of c is %d", c=a++);
printf("n The value of c is %d", c=--b);
printf("n The value of c is %d", c=b--);
}
12
15. Bitwise Operator:-Bitwise Operator:-
Are used by the programmer to communicate
directly with the hardware.These operator are
used for designing bit or shifting them either
right to left, left to right.
Example:-
OPERATOR MEANING
& Bitwise AND
| Bitwise OR
^ Bitwise Exclusive OR
<< Shift Left
>> Shift Right
15
16. SPECIAL OPERATORSSPECIAL OPERATORS
'C' supports some special operators such as comma
operator, sizeof operator and pointerpointer operators.
Comma operator:Comma operator:
the comma operator is used to combine related
expressions.
A comma linked list of expressions are evaluated
left to right and the value of right most expression is
the value of combined expression..
Example: value=(x=10, y=5, x+y);
16