How can I remove a flag in C?

前端 未结 3 1139
感动是毒
感动是毒 2020-12-12 10:23

There is a variable that holds some flags and I want to remove one of them. But I don\'t know how to remove it.

Here is how I set the flag.

my.emask          


        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 10:48

    my.emask &= ~(ENABLE_SHOOT);
    

    to clear a few flags:

    my.emask &= ~(ENABLE_SHOOT|SOME_OTHER|ONE_MORE);
    

提交回复
热议问题