generated from freudenreichan/info2Praktikum-DobleSpiel
Kommentare angepasst
This commit is contained in:
parent
f249355a30
commit
f513d63ebf
10
stack.c
10
stack.c
@ -1,12 +1,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
|
||||||
//TODO: grundlegende Stackfunktionen implementieren:
|
|
||||||
/* * `push`: legt ein Element oben auf den Stack,
|
|
||||||
* `pop`: entfernt das oberste Element,
|
|
||||||
* `top`: liefert das oberste Element zurück,
|
|
||||||
* `clearStack`: gibt den gesamten Speicher frei. */
|
|
||||||
|
|
||||||
// Pushes data as pointer onto the stack.
|
// Pushes data as pointer onto the stack.
|
||||||
StackNode *push(StackNode *stack, void *data)
|
StackNode *push(StackNode *stack, void *data)
|
||||||
{
|
{
|
||||||
@ -14,7 +8,7 @@ StackNode *push(StackNode *stack, void *data)
|
|||||||
{
|
{
|
||||||
return stack; //Nichts pushen
|
return stack; //Nichts pushen
|
||||||
}
|
}
|
||||||
//if(stack && data){
|
|
||||||
StackNode *t = (StackNode *)malloc(sizeof(StackNode));
|
StackNode *t = (StackNode *)malloc(sizeof(StackNode));
|
||||||
if(!t)
|
if(!t)
|
||||||
{
|
{
|
||||||
@ -23,7 +17,7 @@ StackNode *push(StackNode *stack, void *data)
|
|||||||
t->next = stack;
|
t->next = stack;
|
||||||
t->data = data;
|
t->data = data;
|
||||||
return t; //Gibt den ersten StackNode des Stacks zurueck
|
return t; //Gibt den ersten StackNode des Stacks zurueck
|
||||||
//}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user