CSC161 2011S Imperative Problem Solving

Class 45: Linked Lists (2)

Back to Linked Lists (1). On to Linked Lists (3).

This outline is also available in PDF.

Held: Monday, 25 April 2011

Summary: We attempt some hands-on work with the linked list implementation.

Related Pages:

Notes:

Overview:

Detour: Allocating Space with malloc

Program Structure

I've broken our sample linked list code up into parts.

I've chosen an interesting strategy for the design of node.c

To make it easier to write multi-statement macros, I've written a BLOCK macro. The idea is that I should be able to write

  while (x < 10)
    DO_WHATEVER (x);

and have it work whether DO_WHATEVER is a statement, a macro that expands to a statement, or a macro that expands to a sequence of statements. To make that idea work properly, we need to make sure that the macro that expands to a sequence of statements appropriately surrounds those statements. I use BLOCK for clarity.

Lab

Back to Linked Lists (1). On to Linked Lists (3).

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Tue May 10 10:34:35 2011.
The source to the document was last modified on Wed Jan 5 12:52:12 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Outlines/outline.45.html.

Samuel A. Rebelsky, rebelsky@grinnell.edu