Advertisement
KDOXG

A good way to create a flag variable

May 4th, 2019
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. //Bad example
  2.     int flag0 = 0;
  3.     int flag1 = 1;
  4.     int flag2 = 1;
  5.     int flag3 = 0;
  6.     int flag4 = 1;
  7.     int flag5 = 0;
  8.     int flag6 = 1;
  9.     int flag7 = 0;
  10.  
  11. //Good example
  12.     char flag;
  13.     flag &= 127;
  14.     flag |= 64;
  15.     flag |= 32;
  16.     flag &= 239;
  17.     flag |= 8;
  18.     flag &= 251;
  19.     flag |= 2;
  20.     flag &= 254;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement