"Operators r the ones which r used to perform different operations on atleast one operand".
Operators r mainly classified into 5 types
- Arithmetic operators
- Arithmetic assignment operators
- unary operators
- comparison operators
- Logical operators
2. Arithmetic assignment operator:
These operators r used in order to perform assignment operations to assign values to variables (operands).We can perform Operations such as ( +=, -=, *=, /=, %= ) . We shall understand them with examples
- += :- x+=y it implies x=x+y;
- *= :- x*=y it implies x=x*y;
These operators use only single operand. These r mainly used for incrementing and decrementing the value present at the variable. these incrementation process includes mainly post and pre process. we shall see examples,
- ++ which is used as ++x where x is the operand and this is called pre incrementation. where the value is assigned after getting incremented . and if we use the operator like x++ then it is called post increment . and the case is similar with decrement process.
- -- is used for decrementation process . the pre and post decrementations r done similar to that of incrementation process.
These operators r used to compare two values and perform the required action.when ever u use a comparison operator the expression results a boolean value (true or false) .
Comparison operators are ( <, >, <=, >=, !=, ==) .These r used in between two expressions .
5. Logical operators:
These r used to evaluate a expression and return a boolean value . the logical operators includes (&&, !, ||, ^).
6. Terenary operator (or) conditional operator: this operator is used to perform an action based on the result that is generated.
syntax:
expr1? expr2 : expr3
here if expr1 is true then expr2 is printed if it is false then expr3 is printed. In general expr1 contains statements regarding comparison of values present at the operands .
Labels: C# Programming
0 Comments:
Subscribe to:
Post Comments (Atom)