+ 4
How is that work?
int main(){ int = 2; i>>=1; //please help, I dont know how is that line work (what it do) printf("%d",i); //i=1; return 0; }
1 Answer
+ 3
I >>=1 is short form for i = i>>1
>> right shift bitwise operator.
i = 2, in bits 0010 >> right shifting bits 1 time is 0001 is equal to 1.
So now I =1
Edit: SoloLearner
Read more from these:
https://www.sololearn.com/learn/4070/?ref=app
https://www.sololearn.com/learn/4086/?ref=app