function pop is done
This commit is contained in:
parent
69f44a5aa0
commit
5deaf21a61
14
stack.c
14
stack.c
@ -22,12 +22,6 @@ return newNode;
|
|||||||
// freed by caller.)
|
// freed by caller.)
|
||||||
StackNode *pop(StackNode *stack)
|
StackNode *pop(StackNode *stack)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns the data of the top element.
|
|
||||||
void *top(StackNode *stack)
|
|
||||||
{
|
|
||||||
if (stack == NULL)
|
if (stack == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -36,6 +30,14 @@ free(stack);
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the data of the top element.
|
||||||
|
void *top(StackNode *stack)
|
||||||
|
{
|
||||||
|
if (stack == NULL)
|
||||||
|
return NULL;
|
||||||
|
return stack->data;
|
||||||
|
}
|
||||||
|
|
||||||
// Clears stack and releases all memory.
|
// Clears stack and releases all memory.
|
||||||
void clearStack(StackNode *stack)
|
void clearStack(StackNode *stack)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user