Ads (728x90)

Operator in C

Operator most important part of program. Because its used mathematics functions and also use ordinary printf and scanf functions. Operators are execute with 1 or more operands. Some operator use single operand and some operator use 2 operands. 

Operators has different types. It has 8 different types of operator.

  1. Arithmetic operator 
  2. Relational operator
  3. Logical operator
  4. Assignment operator
  5. Shorthand operator
  6. Bit wise operator 
  7. Conditional operator
  8. Comma operator

Arithmetic operator:

Arithmetic operators are take 2 or more numerical operands and give one numerical value as result. Arithmetic operators are addition(+), subtraction(-), division(/) and multiplication(*). 


Relational operator:

Relational operator are used to compare two operands and return either or one. Relational operators are less than (<) , greater than (>), less than or equal to (<=), greater than or equal to (>=).

Logical operator:

Logical operator are used with boolean value and return boolean result. Logical operators are AND (&&) , OR (||), NOT(!).


Assignment operator:

Assignment operator is used to  assign value to variable. It can also use this operator on Relational operator. While assign value to variable it need one operands and one value. Assignment operator is (=).


Shorthand operator:

Shorthand operator is a shorten statement of arithmetic operators. for example if you write a=a+2 mean it will shorted by a+=2;


Bitwise operator:

Bitwise operator used to perform arithmetic operation in bit level. We can execute arithmetic, Logical operations in bit level like 0's and 1's operation.


Conditional operator:

conditional operator is a ternary operator which symbol is (? :). First it converted to Boolean form after that only it execute condition check after that condition true mean one statement  execute other wise other statement execute.


Comma operator:

Comma operator is used separate variable or statement. Its also called separator. Its mentioned by "," operator.

Post a Comment