1. ## Stack::push

This is the struct Stack:

Code:
```struct Stack {
void* data;
void initialize();
void push(void* dat);
void* peek();
void* pop();
void cleanup();
};```
Here is the definitions of functions push() and initialize() of struct Stack:

Code:
```void Stack::push(void* dat) {
}

data = dat;
next = nxt;
}```
This is a comment on push():

" (1) The next pointer is assigned to the current head. (2) Then head is assigned to the new Link pointer. (3) This effectively pushes the Link in at the top of the list. "

I don't understand how (1) and (2) cause (3) to happen. Please explain.

2. Consider a stack.
Code:
```head
|
5->4->3```
You want to push 6. Following the algorithm.

This creates 6 and sets its next pointer to point to 5, so we have this stack.
Code:
```   head
|
6->5->4->3```

Now the algorithm sets head, which is 5, to point to 6. The result is thus.
Code:
```head
|
6->5->4->3```

3. Thanks.

Code:
`newLink->initialize(dat, head);`
points head to 5 and then

Code:
`head = newLink;`
points head back to 6 ?

points head to 5 and then
It doesn't. It points the next pointer of 6 to 5.

5. You're looking at a simple assignment of pointers. With the complexity of an explicit constructor call removed, the code would look like this.
Code:
```void Stack::Push(void* dat) {
}```
Those operations are consistent with the diagrams I gave you previously. Please note that this is not as much an issue of the stack abstraction as a general linked list paradigm. Adding to the front of a singly linked list is a fundamental operation and you should be familiar with it.
Code:
```#include <iostream>

using std::cout;
using std::endl;
using std::cin;

struct node {
int cont;
node *next;
};

int main()
{
node *head = 0; // Null to mark the end of the list
int input;

while (cin>> input) {
node *add = new node; // Allocate space for a new node
add->cont = input; // Set the content