DMP - Chapter 15


Bit Fiddling

Signed integers

Octal (e.g. 0377 == 1111111)

Hexadecimal

Bitwise operators: ~, &, |, ^

Masks (&);

Bit on (| MASK), off (| -MASK)

Toggling bits (^ MASK)

Structure contents in a file

Checking the value of a bit (flag & MASK) == MASK

Bitwise shift operators (<<, >>)

Bit fields
struct 
{ 
 unsigned bit1: 1;
 unsigned bits: 4;
 unsigned bit3: 2;
} flag;
getfile.c

Assignment #17: Due Apr. 2


Go to Ich's Home Page
Go to the Peabody Home Page
For comments or questions email to: ich@peabody.jhu.edu