Friday, October 26, 2018

Conditional Operators

2 comments

Conditional Operators

 Operators are the symbols which is used for performing the basic operation on the data value, operators are the variable of a language that help the use perform computation of value.
 There are following three types of operators available in ‘C’  programming.
  1-Unary Operators: -
  A) Increment
      i) Prefix
      ii) Post-fix
  B) Decrement
      i) Prefix
      ii) Post-fix

2-Binary Operators:
     i) Arithmetic
    ii) Logical
   iii) Assignment
   iv) Relational
    v) Bit-wise
   vi) special operator
 
3-Ternary Operators: -
 i) Condition
Unary operator: -
 C has a class of operator that ate upon a single operant to give a new value. These types of operation are known as unary operators. Unary operator also classified into the two-basic category.

(i) Increment operator: -
  Operator through which the value of operant to be increased.
  Increment operator also categorised into the two basic forms.
  Example: - # Prefix : ++a;
                    # post fix : a++;
(ii) decrement operator: -
  Operator through which the value of to be decrees by one. It  is  also divided into the two basic form.
  Example: - # Prefix : --a;
                    # Post fix : a--;
Binary Operator: -
 Binary operators are these operators which act upon two operands. Hence the binary operator also classified into the six basic categories.

# Arithmetic Operatic: -
 Arithmetic Operator are used for performing most common operation of mathematics like addition, subtraction etc.
Symbol
Meaning
+
Addition
-
subtraction
*
Multiplication
/
Division
%
Modul Division

# Logical Operators: -
 Logical operator operates upon two logical expressions to build more complex logical expression which are either true or false.
Symbol
Meaning
&&
Logical And
||
Logical Or
!
Logical Not

# Assignment Operator: -
 This operator is to be used for assignment the value in a variable.
 =>  It is denoted by the symbol ‘ = ’.

# Relational operator: -
 Relational operators used in C programming for making the relational between two or more variables.
Symbol
Meaning
Greater than
Less than
<=
Greater than & Equal
>=
Less & Equal
==
Is Equal to
!=
Is not Equal to

# Bit-wise Operators: -
 Bit-wise operators of C language are the operators, using which these type of operations are performed which are generally  performed through the low level languages. Bit-wise operator specially used for Bit manipulations.

Symbol
Meaning
          & (Ampersand)
Bit-wise AND
          | (Pipeline)
Bit-wise OR
         ^ (Caret)
Bit-wise x-OR
         ~ (1’s Complement )
Tilde
        << (Left shift)
Double Less then
        >> (Right shift)
Double Grater than


 # Special Operators of C: -
 ‘C’ support same special operators such as comma operator (,),  size of () operator, arrow operator (→), Address operator (&), and Dot operator (.).
     # this () is parenthesis
     # this → is member selection operator.
     # this (.) is period.

Ternary operator: -
 The ternary operator (?), C includes a very special operators called the ternary or conditional operators. It is called ternary because it is used three expression.
Like a short hand version of the if else condition.
Syntax: -
          Condition ? True statement : False statement;
  Ex.: - x > y ? x : y;

2 comments: