I'm preparing for a programming contest and I have stumbled upon the question below.
void main(){
int number, result;
scanf("%d",&number);
result=number-(number&-number); //this is what i'm struggling to understand
printf("%d",result);
}
Note the use of "&-" in the commented line. I couldn't figure out its function. I tried googling and reverse engineering but I couldn't find anything.
Also, the question itself is not about the exact output because the variable "number" is dynamic. I just need to learn what the "&-" part do. Thanks!
The ampersand is a binary AND operator. The minus is just a regular minus. Thanks to @tkausl