generated from freudenreichan/info2Praktikum-DobleSpiel
pop-Funktion angepasst, erfolgreich getestet
This commit is contained in:
parent
2dc724e065
commit
1a5b7cb025
9
stack.c
9
stack.c
@ -31,16 +31,11 @@ StackNode *push(StackNode *stack, void *data)
|
||||
// freed by caller.)
|
||||
StackNode *pop(StackNode *stack)
|
||||
{
|
||||
if(stack)
|
||||
{
|
||||
StackNode *t = stack->next; //Naechstes Element im Stack wird erstes Element
|
||||
free(stack);
|
||||
return t;
|
||||
}
|
||||
else
|
||||
if(stack == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return stack->next;
|
||||
}
|
||||
|
||||
// Returns the data of the top element.
|
||||
|
||||
BIN
test_stack.exe
Normal file
BIN
test_stack.exe
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user