@@ -28,7 +28,12 @@ StackNode *pop(StackNode *stack)
// Returns the data of the top element.
void *top(StackNode *stack)
{
if (stack == NULL)
return NULL;
StackNode *next = stack->next;
free(stack);
return next;
}
// Clears stack and releases all memory.
The note is not visible to the blocked user.