CSC161 2011S Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
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:
Examples/LinkedLists.Notes:
Overview:
malloc.mallocon the fly, we need to create new nodes (pairs) (cons cells) (whatever you want to call them).
malloc (for
memory allocate).
void *malloc(int amt);
struct node *pair = (struct node *) malloc (sizeof (struct node *));
I've broken our sample linked list code up into parts.
node.h - defines the structure and declares primary operations
node.c - implements the operations
expt.h - tools for experimenting with code
utest.h and utest.c - tools for unit testing
I've chosen an interesting
strategy for the design of
node.c
EXPERIMENTS flag, it builds an
executable that runs a series of experiments.
UNIT_TESTS flag and link with
utest.c (or utest.o), it builds an
executable that runs unit tests.
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.
Back to Linked Lists (1). On to Linked Lists (3).
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
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.