Name: ________________________________ Section: _________________
Honor Code Acknowledgment: ___________________
Due: December 6
#includemain() { int num = 25; int * np = # *np = 32; int * list = new int[10]; list[0] = 0; list[1] = num; np = &list[2]; num = 13; *np = 55; cout << list[0] << " " << list[1] << " " << list[2] << endl; }
struct Node
{
string info;
Node * next;
};
Node * LastNode(Node * list)
// postcondition: returns pointer to last node in list
// returns 0 if list is 0
+-----+ +-----+ +-----+ +-----+ +-----+
| 1 | | 2 | | 3 | | 4 | | 5 |
| ----->| ----->| ----->| ----->| ----->NULL
| | | | | | | | | |
+-----+ +-----+ +-----+ +-----+ +-----+
^
|
list--+
after the call list = NumList(5);
Node * NumList(int num)
// preconditoin: 0 < num
// postcondition: returns pointer to linked list containing num values
// in order 1, 2, 3, ... , num