Operators in C language

operator
are the symbol that act upon data .They represent a particular operation to be performed on the data. Operator can be classified in the following categories:

•Arithmetic Operators:

The arithmetic operator perform arithmetic operation on any built in data type.

Operator                    Function

+                                       Addition
-                                        Subtraction
×                                       Multiplication
/                                        Division
^                                       Exponentiation
%                                      Modulus(Remainder)

•Special Arithmetic Operation:


++           :         increment
 --            :         decrement
X++ or   :          is equivalent to X=X+1
++X
Similarly
X-- or --X  :      is equivalent to X=X-1

•Relational Operators


These operators are used to compare two values on the basis of a certain condition .

Operator                    Function

<                                        Less than
<=                                      Less than equal to
>                                        Greater than
>=                                    Greater than equal to
!=                                      Not equal to
==                                      Equal to

•Logical Operators:

These operators are used to perform logical operation.

Operator                  Function

&&                                    AND
||                                      OR
!                                         NOT

• Assigning Operators:

These operators are used to assign values to variable.

Operator          Function

=                          Assign a value
+=                       Add the value and assign it 
                             to the left.
-=                       Subtract the value and assign
                             it to left side.
*=                      Multiple the values and assig-
                            n it to left side.
/=                      Divide the values and assign it
                            to left side.
%=                     Find the reminder and assign
                           it to the left side.

•Ternary Operators:

These operators are very powerful operators in C language. In some cases ,it equivalent to the "if" - els statement.

Operators"?" and ":"

syntax=> expression =exp 1? exp 2: exp 3;

Example:
a=50;
b=a>100?25:35;
Here the value of b will be 35 because a is less than 100 and the condition is false .

                                        Harshit kumar

                                                       Admin

Comments

Popular posts from this blog

How To Hack Wifi | Hack Wifi Password | TECH WORTH MIND

Remove Tools From Termux | How can I reopen the installed tool in termux? | TECH WORTHY MIND