Monday, June 23

What do you mean by ASSIGNMENT OPERATORS


What are assignment operators ? well an assignment operator is used to assign back to a variable , a modified value of the present holding...
The symbol = is used as an assignment operator and it is evaluated at the last. Remember that equal to(=) is an operator and not an equation maker and hence , it can appear anywhere in place of another operator. Some of the assignment operator are as follows :
OPERATOR MEANING
= Assign right hand side (RHS) value to the left hand side(LHS)
+= Value of LHS variable will be added to the value of RHS and assign it back
to the variable in LHS.
-= Value of RHS variable will be subtracted from the value of LHS and assign
it back to the variable in LHS.
*= Value of LHS variable will be multiplied by the value of RHS and assign it
back to the variable in LHS.
/= Value of LHS variable will be divided by the value of RHS and assign it back
to the variable in LHS.
%= The remainder will be stored back to the LHS after integer
division is carried out between the LHS variable and the RHS variable.
>>= Right shift and assign to the LHS
>>= Left shift and assign to the LHS
&= Bitwise 'AND' operation and assign to the LHS
= Bitwise 'OR' operation and assign to the LHS
~= Bitwise 'COMPLEMENT' and assign to the LHS
The following are valid C++ statements:
a=b=c+4;
c=3*(d=12.0/x);
Here: 1. x+=y is equal to x=x+y
2. x-=y is equal to x=x-y
That's enough for today do come tommorow for some interesting topic...........

0 comments:

Followers

Archive

 

Money ,Entertainment and Education. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com