Which rows contain errors when applying prefix and postix operators?

bool b(false);
++++b;    //1
b++++;    //2
b++;      //3
b--;      //4
Explanation
Error on line 2: the first operator "++" will work and will return (as postfix operator should do) rvalue, but applying operator "++" to the rvalue (both postfix or prefix) is not allowed. That's why an error arises here because of the presence of the second increment operator. Standard 5.2.6
Error on line 4: you can not use the "--" (both prefix and postfix) for variable of type bool. Standard 5.2.6

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты