struct Node {
int value;
Node *n;
};
void push (Node *front, int value) {
Node new;
new.n = front;
new.value = value;
Node *newPtr = &new;
front = newPtr;
}
int pop (Node *front) {
int n = front->value;
front = front->n;
return n;
}
I tried to implement stack without dynamic memory allocation this way, but I failed to make it work. Any hints on what I should be doing to make it work?