Saturday, April 2, 2016

Operators in C programming language


The symbols which are used to perform Athematic (mathematical), logical, rational operations in a C language are calledC operators.
Operator consists of following types:
Athematic Operators:
addition is denoted by a + sign. We use addition to add two variables.
subtraction is denoted by a - sign
multiplication is denoted by a * sign
division is denoted by a / sign
modulus (remainder) % : mod operator in c programming languageis used to find the remainder of some division.
Relational Operators:
Relational operators in c language is used to relate one operand with the other. the relational operators are : < Specifies that left-hand operand is less than right-operand
<= Specifies that left-hand operand is less than or equal to right-hand operand
> Specifies left-hand operand is greater than right-hand operand
>= Specifies that left-hand operand is greater than or equal to right-hand operand
== Specifies that left-hand operand is equal to right-hand operand
!= Specifies that left-hand operand is not equal to right-hand operand 
Logical Operators:
C programming language provides the following binary logical operators for program:
&& : Operation AND : returns true if both operands are true
|| : Operation OR : returns true if a single operand or both operands are true
^^ : Operation XOR : returns true if exactly one operand is true
binary operator:
C language provides the following binary logical operators for program:
& : Performs AND operation
| : Performs OR operation
^ : Performs XOR operation
<< : Performs Shift operation i.e. left shifting left hand operand by the number of bits specified by the right-hand operand
>> : Performs Shift operation i.e. right shifting-left hand operand by the number of bits specified by the right-hand operand.
The shift operators are used to move bits left or right in a given integer value specified. Shifting left will consume empty bit positions on the right-hand side of the result producing zeroes
Assignment Operators:
C programming language provides the following binary logical operators for program:
= : Equates left-hand operand equal to the right-hand expression value
+= : Increments the left-hand operand specified by right-hand expression value
-= : Decrements the left-hand operand specified by right-hand expression value
*= : Multiply the left-hand operand specified by right-hand expression value
/= : Divide the left-hand operand specified by right-hand expression value
%= : Modulo the left-hand operand specified by right-hand expression value
|= : Performs Bitwise OR operation between the left-hand operand with the right-hand expression value
&= : Performs Bitwise AND operation between the left-hand operand with the right-hand expression value
^= : Performs Bitwise XOR operation between the left-hand operand with the right-hand expression value 

0 comments:

Post a Comment