generated from freudenreichan/info2Praktikum-DobleSpiel
StackNode *push implementiert
This commit is contained in:
parent
1ec5d2745b
commit
0b29a58438
9
stack.c
9
stack.c
@ -10,6 +10,15 @@
|
|||||||
// 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)
|
||||||
{
|
{
|
||||||
|
//Speicher reservieren
|
||||||
|
StackNode *newNode = malloc(sizeof(StackNode));
|
||||||
|
if (!newNode)
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
newNode->data = data;
|
||||||
|
newNode->next = stack;
|
||||||
|
|
||||||
|
return newNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user