Chapter 12. Operations on Bits
AS MENTIONED ON PREVIOUS OCCASIONS, the C language was developed with systems programming applications in mind. Pointers are the perfect case in point because they give the programmer an enormous amount of control over and access into the computer’s memory. Along these same lines, systems programmers frequently must get in and “twiddle with the bits” of particular computer words. C provides a host of operators specifically designed for performing operations on individual bits.
Recall from the discussions in the previous chapter the concept of a byte. On most computer systems, a byte consists of eight smaller units called bits. A bit can assume either of two values: 1
or 0
. So a byte stored at address 1000 in a computer’s ...
Get Programming in C, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.