06-06-2013, 03:59 PM
Operators and Expressions
Operators.pptx (Size: 93.66 KB / Downloads: 15)
Introduction
Operators are the symbols that tells the computer to perform certain mathematical task or logical manipulation
C# Operators can be classified into
Arithmetic Operators
Relational Operators
Logical Operators
Assignment Operators
Increment/Decrement Operator
Conditional Operator
Bitwise Operator
Special Operator
Relational Operator
We often compare two quantities and depending on their relation, take certain decision
Eg. Compare age of two persons
These comparison can be done with the help of relational operators
It returns answer in
True or False
Assignment Operators
It is used to assign value of an expression to a variable
Assignments operators are
‘=’ eg: variable = expression
You can also use shorthand assignment operator
Eg: a = a + b can be written as a += b
Implicit Conversions
That is the conversion done by compiler, without explicit request to do so
For example short can be converted in to int, because short range is subset of int range
short b =75;
int a = b; //implicit conversion
It is also known as automatic type conversion
The process of assigning smaller type to a larger one is known as widening or promotion
The process of assigning larger type to smaller one is known as narrowing