What will be displayed as a result of the program's execution?
#include <iostream>
int main(void)
{
    int a=5;
    a<<=3;
    std::cout << a;
    return 0;
}
Explanation
"<<=" - it's a compound assignment operator, such as, for example, += or -=
The "a<<=3" expression is equivalent to the "a = a << 3" expression and means "move the binary representation of the "a" variable three places to the left and assign the received value to the "a" variable"
Was a=5: 00000101
Became а=40: 00101000

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes