Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
struct Point { double x, y; }; struct Node { Point data; Node* next; }; Node *L; double a, *ptr; Point p;
expression | type |
*L | |
L = &p | |
&(L->data) | |
L.next | |
p->x | |
*ptr = L->data.x | |
*(L->next) | |
&a | |
L->next->data.y | |
new Node |
struct Node { int data; Node* next; };and variables
L
and t
, both of type
Node*
, with the values depicted in the figure to
the right, write statement(s) that perform the following.
Note: each problem is independent, meaning that changes in one
part are not carried forward into the next part.
t
points to to the front of
the list L
— i.e. after these
statements, L
should point to the list
5,8,2,7.
~/$ ./prog Enter a list of positive numbers, terminated by zero: 7 2 9 33 14 10 9 18 7 0 The last number was 7 The next to last number was 18
codeprint foo.h foo.cpp bar.cpp
),
and a screenshot of a terminal window showing the program
being compiled and running on the above example.