function top is done

This commit is contained in:
regis37 2025-11-26 22:54:27 +01:00
parent bc6ec040b7
commit 69f44a5aa0

View File

@ -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.