Posted by Matthew Pratt on 1999-05-01
--- Frank Hale <frankhale@xxxxxxxx.xxx.xxx> wrote: > Okay say I have a byte > > /* Bit No. 7 6 5 4 3 2 1 0 > S V B D I Z C */ > byte flags; > > I want to set individual bits in the byte. How would > I go about setting > them in C? > Use the OR function "|". eg: result = vara | varb; Truth table for OR: A B | A OR B --------------- 0 0 | 0 0 1 | 1 1 0 | 1 1 1 | 1 === Matty . http://members.xoom.com/mattpratt/ _--_|\ mattpratt@xxxxx.xxx / \ s3099239@xxxxxxx.xxx.xxx.xx \_.--._/<--Canberra, W2K - The other millenium bug. v Australia _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Previous post | Next post | Timeline | Home