Relational ,Logical,Assignment,increment operators

Tuesday, 15 January 2013

Relational operators:

  • Relational operators are used to compare two operands.
  • c-language supports 6 relational operators.
  • they are <,>,<=,>=,==,!=
  • Relational operators produce t/f result 
  • i.e 0 is called false
  • non-zero is true.

Logical operators:

  • in c-language logical operators are used to combine two expressions.
  • c-language support 3 logical operators
operator
meaning

    !
Logical not
Unary operator
   ||
Logical oR
Binary operator
   &&
Logical and
Binary perator

Assignment operator:

  • It is used to initialize the variable or assign a value to the variable.
  • symbol is =
          example:  a=10;
  • assignment operators are =,+=,- =,*=,/=,%=

Increment  and Decrement operators:

  • c-language has two useful operators these are increment(++) and decrement (--) operators.
  • the ++ adds 1 to variable and decrement subtracts 1 from the variable.
  • these operators are called unary operators because they acts up on one variable.
operator
meaning
++a

--a

a++


a--
Pre incement
Pre decrement
Post increment
Post decrement
    

No comments:

Post a Comment