Skip to Content
Computers as Components, 2nd Edition
book

Computers as Components, 2nd Edition

by Marilyn Wolf
July 2008
Intermediate to advanced
544 pages
16h 52m
English
Morgan Kaufmann
Content preview from Computers as Components, 2nd Edition
5.2 Models of Programs 215
/* update the tail */
tail = wrap(tail);
/* add val to the tail of the queue */
q[tail] = val;
}
And here is the code for removing an element from the head of the queue, known as
dequeueing:
int dequeue() {
int returnval; /* use this to remember the value that
you will return */
/* check for an empty queue */
if (head == wrap(tail)) error(DEQUEUE_ERROR);
/* remove from the head of the queue */
returnval = q[head];
/* update head */
head = wrap(head);
/* return the value */
return returnval;
}
5.2 MODELS OF PROGRAMS
In this section, we develop models for programs that are more general than source
code. Why not use the source code directly? ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computers as Components, 3rd Edition

Computers as Components, 3rd Edition

Marilyn Wolf
Computer System Designs: System-on-Chip

Computer System Designs: System-on-Chip

Michael J. Flynn, Wayne Luk
PC Hardware in a Nutshell, 3rd Edition

PC Hardware in a Nutshell, 3rd Edition

Robert Bruce Thompson, Barbara Fritchman Thompson

Publisher Resources

ISBN: 9780123743978