On Dec 24, 2007 3:46 PM, johmgolden051500 <[EMAIL PROTECTED]> wrote:
> --- In [email protected], "John Monte" <[EMAIL PROTECTED]> wrote:

> Ok if you type in the following
>  void main ()
> {
>    bit
> }
> The word bit will turn blue which indicate it is some type of data
> type.

Turn blue?

> I have one book that it shows is as bit 1 bit long and the
> comments reads it as boolean value but it does not shows any example of
> it.  What I am looking to do is the following.
>  unsigned char i;
>  unsigned char flag; // using the varible each flag bit to indicate a
> flag
>   if (flag && 1) ; when flag,0 = 1 then I will increment else i = 10
>      i++;
>    else
>      i = 0x0a;
>  I want to use each bit of flag for some type of flag in my prgram.
> When I try the above code and when flag bit 0 = 0 it will not go to the
> else statement. Is there something I am missing here. I'm a newbie with
> c code and I apperciate the help and the feed back in here.

There are no "commands" in C for handling bits, but there are bitwise operators:

& = bitwise AND
| = bitwise OR
~ = bitwise NOT
^ = bitwise XOR
<< = shift left
>> = shift right

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to