Most elegant way to change 0 to 1 and vice versa

后端 未结 6 1065
眼角桃花
眼角桃花 2020-12-01 02:49

What is the most elegant way to do the next stuff:

int i = oneOrZero;

if (i == 0) {
   i = 1;
} else {
   i = 0;
}

You can assume that

6条回答
提交回复
热议问题