Compound Assignment Statement.

hello,

i m new in c++

Help me to understand about Compound Assignment Statement

thanks
The compound assignment operators are +=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=, and they have the same effect as normal operators, but on the variable they are changing. For instance, a += b; would be the same as a = a + b;.
http://www.cplusplus.com/doc/tutorial/operators/
It gets complicated when you begin to work with bitwise operators however. I recommend reading this: http://www.cprogramming.com/tutorial/bitwise_operators.html
motin wrote:
Compound Assignment Statement
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//I was thinking:
int a = b = c = 3;
//which is the same as...
int a = 3, b = 3, c = 3;
//which is the same as.....
int a = 3;
int b = 3;
int c = 3;
//which is the same as.......
int a;
a = 3;
int b;
b = 3;
int c;
c = 3;
Last edited on
That's not compound assignment, I believe that's chained assignment.
u can visit this link for better help
http://techyv.com/questions/compound-assignment-statement
Topic archived. No new replies allowed.