
CS485G Spring 2015 8
6. A buffer is also an array of bytes, typically used to hold data sub-
ject to I/O. The bytes hold arbitrary binary values, not necessarily
printable values.
7. Declaration
(a) char
*
myBuffer;
(b) char myBuffer[];
(c) char myBuffer[4096];
8. Buffers are not null-terminated; you need a separate variable to re-
member how much data is in the buffer.
10 Boolean algebra
1. Lecture 6, 1/28/2015
2. Named after George Boole (1815–1864).
3. A computer’s circuitry uses pieces that accomplish Boolean func-
tions in order to build both combinatorial and sequential circuits.
4. We are familiar with the truth tables for and (in C: &), or (|), not (˜).
We might not be familiar with exclusive or (xor, ˆ).
5. When one operates on bytes (or larger chunks such as integers) with
Boolean functions, they are applied bitwise. Examples:
01101001 105
&01010101 85
========
01000001 65
6. Instead of interpreting 32 bits as an integer, we can interpret it as a
subset of {0, . . . , 31}. Each 1 bit represents a number in that range
that is in the set; every 0 bit represents a number that is not in the set.
So 1001 represents the set 0, 3. Then:
(a) & is intersection.
(b) | is union.
(c) ˆ is symmetric difference.
(d) ˜ is complement.
Comentarios a estos manuales