Different Types of Operators in C| Operators In C with Example| What Are Operators in Programing| 8 types of Operator

Different Types of Operators in C| Operators In C with Example| What Are Operators in Programing| 8 types of Operator, what are operators and its type

Different Types of Operators in C|Operators In C with Example| What Are Operators in Programing|8 types of Operator


    What is an Operator?

    In Any Program we have to Perform different-different Operations, so We use operators to perform these action or in other words, An Operator is a symbol used to perform operations in a given programing language. Some of these symbols are +,=,!,<> and many more. There are Different types of Operators which are used to Perform different type of Action in any program by the help of programing language. SO lets look what are different types of Operators:-

    Types Of Operators

    As we Discussed Above, There are Different types of Operators which are used to perform different type of Action or Operations. There are around 8 types of operators which are used in C Language, but majorly there are only 5 Operators. So Lets look to those 5 Operators which are used the most in Creating a high and good Program. 

    5 Types Operators which are used in C Languages:-

    1. Arithmetic Operators
    2. Relational Operators 
    3. Logical Operators
    4. Bitwise Operators
    5. Assignment Operators

    Lets look into what are these operators and where they are used for performing operations.

    1. Arithmetic Operator 

    Arithmetic Operators are those operators which are used to perform mathematical Operation like Addition, Multiplication, Divide, Subtraction. These are basic foundation of doing any calculations which will be used in Program's. So Lets Look at these with a example.

    Code

    #include<stdio.h>
    int main(){
    
    int a,b;
    a=34;
    b=6;
    
    printf("a+b=%d",a+b);
    
    
    
    }

    Output

    a+b=40

    Relational Operator

    Relational Operators are used to Define Relations Between the two entity we are using in the Program. These are of Different Types, Equal to, not equal to, greater then etc etc. Lets look on these operators and understand it, use of them in creating a Program.
     
    Operators Description
    == Is Equal to
    != Is Not equal to
    > Greater then
    < Less then
    >= Greater then or Equal to
    <= Less than or equal to

    Logical Operators

    Logical Operators are used to Create Logics in a program. They are Very Important if we want to create high level programs with some conditions and Logics. Lets understand types of Logical Operators and their USE.

    Logical Operator Use Of Logical Operator
    && Logical AND operator. If both the operands are non-zero, then the condition is true
    || Logical OR Operator. If any of these two operands is non-zero then condition becomes true
    ! Logical NOT Operator. It is used to reverse the logical NOT Operator will make it False

    Bitwise Operator

    Bitwise operator is an Different type of Operator in which we perform the operations at a bit level. There are different type of Bitwise Operator. Lets Understand it By looking at their sign and use of them.


    Operator Name
    & Bitwise AND
    | Bitwise OR
    ^ Bitwise XOR
    ~ Bitwise Complement
    << >> Bitwise Shift Operator

    Assignment Operator

    Assignment operator, as the name says it, it is used to assign values, names and symbols to different data types which we are going to use in a Program. It is Mainly used in every and most of the Programs that we are using in daily life.

    Operator Description
    = Assigns Value from right to Left Operator
    += It add right to left and assign the result to the left
    -= Subtracts the right opearand form the left an assign left
    *= Multiply
    /= Divide

    These are the Main and Major type of Operators which are used in C Language. Operators play a Vital role in creating a good level program with high usability. You can Create Different types of programs using these operators and use them. The good example of a Program is Calculator, Name Adder etc etc.

    Post a Comment