What is Operator?
An operator in programming is a symbol that tells the
computer to perform a specific mathematical, relational, or logical operation
and produce a final result.
What is operand?
An operand in programming is used to describe any object
that can being manipulated. Typically, operands are the data on which operators
such as addition or subtraction perform their actions. They can be constants,
variables, or expressions, representing values in calculations or other
operations.
There are some operators in C programming language.
Binary
Operators |
Unary
Operators |
Thernory
Operators |
Arithmetic operators |
Increment, decrement operators |
Conditional Operator |
Logical Operators |
Type cast operator |
|
Relational Operators |
Sizeof operator |
|
Bitwise Operators |
|
|
Assignment Operators |
|
|
Comma operators |
|
|
Arithmetic Operators;
Operator |
Description |
A+B |
Adds A with B |
A-B |
Subtracts B from A |
A*B |
Multiplies A by B |
A/B |
Divides A by B |
I%J |
Gives the remainder of I divided by J |
Logical Operators;
Operator |
Description |
A
&& B |
If one value is 0 the answer is 0 |
A||B |
If one value is 1 the answer is 1 |
!A |
If the value is 0 answer is 1 either
value is 1 answer is 0 |
Relational Operators;
Operator |
Description |
A <
B |
The value of A is less than value of B |
A <=
B |
The value of A is less than or equal
to value of B |
A >
B |
The value of A is greater than value
of B |
A
>= B |
The value of A is greater than or
equal to value of B |
A ==
B |
The value of A is equal to value of B |
A !=
B |
The value of A is not equal to value
of B |
Bitwise Operators;
Operator |
Description |
A &
B |
Bitwise form of A AND B |
A | B |
Bitwise form of A OR B |
A ^ B |
Bitwise form of A XOR B |
~ A |
Bitwise complement of A |
A
<< n |
Shifts A to the left n bits |
A >>
n |
Shift A to the right n bits |
Increment and Decrement Operators;
Operator |
Description |
++A |
increments A and then uses its value
as the value of the expression |
A++ |
uses A as the value of the expression and then increments A |
-- A |
Decrements A and then uses its value
as the value of the expression |
A-- |
Uses A as the value of the expression
and then decrement A |
Assignment Operators;
Operator |
Expression |
Description |
= |
X = Y |
Assign Y
value to X |
+= |
X =+
Y |
X = X + Y |
-= |
X - =
Y |
X = X - Y |
*= |
X *=
Y |
X = X* Y |
!= |
X /=
Y |
X = X / Y |
%= |
X %=
Y |
X = X %
Y |
Size of Operators;
Eg: sizeof A : has as its value the number of bytes required to hold the result of the evaluation of A.
Comma Operator;
A comma operator linked expression is evaluated from left to right and the value of the right most expression is the value of the combined expression.
Eg: x = (a=2,b=4,a+b)