CS 61C Quiz - Week 1-2, Thursday

Current time: Fri Aug 22 19:41:50 2025

Deadline: Thu Jun 24 11:00:00 2004

Name:
SID:
Login:cs61c-

Question 1:

Define a struct for a node of a linked list of strings.

Question 2:

Suppose that the variable named "head" contains a pointer to the 
first node of a linked list, defined as in #1, and the variable 
named "name" contains a pointer to the first character of a C-style 
string. Give a program segment that adds a node containing a copy 
of the string to the head of the list. 
The diagram below show an example of the effect of your statement. 

Before your statement:

name        head
+---+       +---+    +-------+
| * |       | *-|--->| * | *-|---> ...
+-|-+       +---+    +-|-----+
  |                    |
  v                    v
 "bush"               "clinton"

After your statement:

name        head
+---+       +---+    +-------+    +-------+
| * |       | *-|--->| * | *-|--->| * | *-|---> ...
+-|-+       +---+    +-|-----+    +-|-----+
  |                    |            |
  v                    v            v
 "bush"               "bush"       "clinton"

Question 3:

What did you find difficult or confusing about the reading? If nothing was
difficult or confusing, tell us what you found mostinteresting. Please be as
specific as possible.

Send a confirmation email to my class account.