Opretors

  ((Arithmetic Operators)): -
1.      Arithmetic Operators: -
Integers, Floating point numbers and double precision numbers can be added, subtracted, divided or multiplied. The operators used for these arithmetic operations are called arithmetic operation.
The arithmetic operators in C include:
Sr no-OPRETERS- [{MEANING}]     
1)     +   -------Add two operands
2)    —  --------Subtract second operand from the first
3)     *   ---------Multiples the both operands
4)     /   ---------Divides numerator by de-numerator
5)    %   ---------(Modulus) division/ remainder of after an integer division
Note: The modulus operator can be used only when both the operands are integers.
         
        ((Relational/Conditional Operators)): -

2.      Relational/Conditional Operators: -
The relational operators allow us to compare two values to see whether they are to each other,
Unequal, or whether one is greater than the other. The operators used in C are as follows:
 
Sr. No.-----Operators----Meaning

1) ---------     ==   -------- Is equal to
2) ---------     != ------Is not equal to
3) ---------     <  ------Is less than
4) ---------    >  ------Is greater than
5) --------    <= ------Is less than or equal to
6) --------   >= ------Is greater than or equal to
       ((Logical Operators)): -
3) Logical Operators: -
Logical operators are used when more than one conditions has to be tested to make a decision. The following are the logical operators used in C:
Sr. No.---Operators-------Meaning
1)   ------------&&-------(AND) It returns true if all conditions are true.
2)    -----------    ||  ------(OR) It returns a true if anyone or many of the conditions are true.
3)   ------------  !  ------(NOT) It returns a true if condition is false &returns false if condition true
        ((Bitwise Operators))
4) Bitwise Operators:-
 Sr. No.------Operators-----Meaning
1)    ----------    &-----------(Binary AND) Copies a bit to the result if it exists in both operands
2)    ---------     |    --------(Binary OR) Copies a bit if it exists in either operand.
3)  -----------    ^   --------(Binary XOR) Copies the bit if it is set in one operand but not both
4) -----------    ~   ---------Binary 1’s complement operator is unary & has the effect of 'flipping’ bits. E.g. A=00001011 after 11110100
5) -----------    <<     ---------Binary left shift operator. E.g. A=00001011 after 00101100
6) -----------    >>     ----------Binary Right shift operator. E.g. A=00001011 after 00000010
      ((Assignment Operators))
 5) Assignment Operators:-
Sr. No.-----Operators------Meaning
1)  ---------   = --------  Assign value from right side to left operand
2)  ----------  += ---------Adds right to left operands & assign result to left operand
e.g. B+=A is equivalent to B=B+A
3)  -----------    -=    Subtracts right from left operands & assign result to left operand
e.g. B-=A is equivalent to B=B-A
4) ----------   *=  ----------Multiplies right with left operands & assign result to left operand
e.g. B*=A is equivalent to B=B*A
5) ----------  /=  ------  divides left with right operand & assign result to left operand
e.g. B/=A is equivalent to B=B/A
6)  ----------  %= -------- take modulus using two operands & assign result to left operand
e.g. B+=A is equivalent to B=B+A

0 comments:

Post a Comment