+ 1

What is happening exactly?

Hey everyone. I‘m a litte lost here... what exactly happens here: d *= arr[x] ? I can‘t figure out the outcome of 4.5 logically :( I‘d be grateful for any advice. https://code.sololearn.com/cyzkRo671Rqc/?ref=app

17th Jun 2020, 8:08 AM
The_Fox
The_Fox - avatar
5 Réponses
+ 4
d*=arr[x] means d=d*arr[x] so first, d=1*3 then ,d=3*0.5 then,d=1.5*2 then ,d=3*1.5 so finally d=4.5
17th Jun 2020, 8:17 AM
Abhay
Abhay - avatar
+ 2
d *= arr[x] Is same as d = d * arr[x]
17th Jun 2020, 8:16 AM
Arsenic
Arsenic - avatar
+ 1
Now I get it :) I was confused with the * because I was working with pointers and , well, beginner‘s fault I guess :)
17th Jun 2020, 8:20 AM
The_Fox
The_Fox - avatar
+ 1
Yep, thank you.
17th Jun 2020, 8:25 AM
The_Fox
The_Fox - avatar
0
Look if we assume that s is stands for sign then X s= Y; will be X = X s Y Like X+=y X-=y X*=y X/=y X%=y And other bitwise operators
17th Jun 2020, 8:23 AM
ycsvenom
ycsvenom - avatar