Operators New
Operators New
In this example program, two values “40” and “20” are used to perform
arithmetic operations such as addition, subtraction, multiplication,
division, modulus and output is displayed for each operation.
2.ASSIGNMENT OPERATORS IN C
In C programs, values for the variables are assigned using assignment operators.
For example, if the value “10” is to be assigned for the variable “sum”, it can be
assigned as “sum = 10;”
Decimal values are converted into binary values which are the sequence of bits and
2. | – Bitwise OR
3. ~ – Bitwise NOT
4. ^ – XOR
This operator results in 1 when the values of both the bits are 1.
Bitwise OR operator
This operator is a unary operator which means it requires only one operand.
It is also known as a bitwise complement or one’s complement operator. This operator is represented by the
tilde sign (~).
When applied on bits, this operator converts all zeroes (0’s) to ones (1’s) and vice versa.
Bitwise XOR operator
For opposite bits it results in 1 and for the same bits it results in 0.
Left shift operator
It is represented by the ‘<<’ sign. It is used to shift all the bits to the left by a specified
number of bits.
Right shift operator
It is represented by ‘>>’ sign. It is used to shift all the bits to the right by a specified
number of bits.
6.Conditional Operators in C
7.Increment/Decrement Operators in C
Increment operators are used to increase the value of the variable by one.
Decrement operators are used to decrease the value of the variable by one in C
programs.
8.Special Operators in C
Below are some of the special operators that the C programming language
offers.
Dr.R.KARTHIKEYAN/PROFESSOR/CSE(AI&ML)/V
ARDHAMAN COLLEGE OF ENGG.