Home | | Schedule | | Assignments | | Lectures | | Resources
Question 1 Draw an illustration of the pointers x, y, and z before line 14 is executed.
Question 2 Draw an illustration of the pointers x, y, and z before line 20 is executed. You may assign a pointer to any memory cell in your picture.
Question 3 Draw an illustration of the pointers x, y , and z before line 22 is executed. Make sure that your picture is consistent with your answer to the previous question.
Question 4 Draw an illustration of the pointers x , y, and z after line 25 is executed.
Question 5 What would be printed by the latter statement?
20 20
Question 6 Draw an illustration of the linked list after each execution of the statement
lastNodePtr = newNodePtr;
in the BuildList() function. Be sure to include the variables theList, newNodePtr, and lastNodePtr in your picture. You may use whatever friends' names you wish.
Question 7 What is the purpose of the statement
NodePtr currNodePtr = theList;
at the beginning of the PrintList() function?
It sets the newly declared pointer, currNodePtr, equal to theList. Since theList points to the first node in the list, this means that currNodePtr will now point to the beginning of the list too.
Question 8 What is the purpose of the statement
currNodePtr = currNodePtr->next;
in the PrintList() function?
This statement moves the currNodePtr to the next item in the list, essentially moving one step forward for each iteration of the loop.
find_item.cc - Clean code for ItemInList function.
Home | | Schedule | | Assignments | | Lectures | | Resources
CSCI 131: Techniques of Programming
Last Modified: April 11, 2014
Page Expires: October 12, 2014