I have another question now. I am trying to set a bit in unsigned, that is what I am doing:
#include <iostream>
using namespace std;
int main(){
unsigned i = 0;
unsigned index = 1;
i >> (31 - index) |= 1;
}
But I am getting this error:
invalid lvalue in assignment at line 8.
Can't figure that out.
Thanks for helping.
The left hand side of your expression does not compile to a memory address, which is necessary for the assignment to occur.
Set a bit like this:
i |= (1 << index);