In Our Last Session we have seen the Variable, How it can be created, how it can store the certain type of the value according to the Datatype that we have given while declaring that variable, then we have seen the Datatype concept and its limit and type of values they support along with Variable.

We have seen the Array Concepts, their structure, their mechanism and working along with that we have seen Queue and Stack Concepts and similar to that we have seen the Link-Lists their structure and working. Now we are going to see the OPERATOR concepts.

Operators:

Q. What are the Operators?

Q. What are the Types of the Operators?

What are the Operators?

è Operators are certain symbols, these are used while performing some operations, Actions.

Now How does a programming language come to know that the certain operators or a specific operator perform respective action?

è Now that need some explanation, Each and every programming language or with more specifically we say a compiler have some library files those library files contains the specification of these operators they may called Keyword or Tokens, as + will perform addition , * will perform multiplications, % will return the remainder and / will returns the quotient.

What are the Types of the Operators?

We must understand one thing about Operators that they always works on two operands and they works with respect to the left operand.

è Operators can be defined into different types

- Arithmetic Operators => used for Arithmetic Operations

+: Addition. E.g. a=a+b

-: Subtraction E.g. a=a-b;

*: Multiplication E.g. b=a*b;

%: Mode E.g. c=a%b; returns the remainder

/: Division .Eg c=a/b; returns the quotient

- Logical Operators => Used for logic operations (inclusion, exclusion etc.)

||: OR. E.g. a||b – a or b

&&: And. E.g. a&&b – a and b

! : Not. E.g. b =! (A) – negation of a is assign to b

- Relational Operators => Used To show the Relationship in-between the operands

>: Greater than Operator. E.g. a>b – value of a is greater than value of b.

<: less than Operator. E.g. a<b – value of a is less than value of b.

>=: Greater than equal to E.g. a>=b – value of a is greater than Equal value of b.

<=: Less than equal to. E.g. a<b – value of a is less than Equal to value of b.

==: Equals to E.g. a==b – value of a is Equals to the value of b.

<>: Not Equals To E.g. a<>b – value of a is not Equals to the value of b.

- Assignment Operators => These Operators are used for Assignment

=: Assignment operator. E.g. a=b – b is value is assigned to the variable a.

+=: Addition Assignment. E.g. a+=b equivalent to a=a+b;

*=: Addition Assignment. E.g. a*=b equivalent to a=a*b;

/=: Addition Assignment. E.g. a/=b equivalent to a=a/b;

-=: Addition Assignment. E.g. a-=b equivalent to a=a-b;

%=: Addition Assignment. E.g. a%=b equivalent to a=a%b;

>>=: Addition Assignment. E.g. a>>=b equivalent to a=a>>b;

<<=: Addition Assignment. E.g. a<<=b equivalent to a=a<<b;

- Bitwise Operators => These operators works on the Bit level (binary level)

|: Bitwise Or operator.

&: Bitwise And operator.

^: Bitwise xor operator.

E.x.

Declaration of variable: int a,b,c;

Initialisation of Variable: a=input; b=input;

Ex a=5; b=5;

Operations: c=a+b; /* var c stores the addition of a and b */

Processing and display = print c;

Copyright © 2019 LearnWithUs - All Rights Reserved.

Powered by asAsk Tech