What will be the output of code
int a=3,b=4;
++a*=++b;
cout<<a<<endl;
compiler shows a=20
output.How precedence
and operator associativity
is being used here?
What I understand is:
first b
on the left of ++a*=++b;
is incremented us its unary
operator then comes the
turn of *=
so
expression becomes ++a = a * ++b;
as a=3
and b=5
now so it becomes 15
then 15
is assigned to a
and incremented.Finally getting 16
but compiler gives 20