I'm aware that it can never be negative but what happens to the value in memory after it goes "below" 0?
example:
unsigned int i = 3;
while(i >=0){
print("something");
i=-i;
}
I'm aware that it can never be negative but what happens to the value in memory after it goes "below" 0?
example:
unsigned int i = 3;
while(i >=0){
print("something");
i=-i;
}
The unary -
operator on an unsigned operand does not produce a value below zero. It produces a value which, when added to the operand in ordinary integer arithmetic, would yield one plus the maximal value the type can represent.