From f407f0f837c8dceae882f48adc2c23a8d531736b Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 15 Dec 2025 14:36:30 +0100 Subject: [PATCH] =?UTF-8?q?malloc=20=C3=9Cberpr=C3=BCfung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- I2_Dobble/stack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/I2_Dobble/stack.c b/I2_Dobble/stack.c index 2bc5825..efb5cb2 100644 --- a/I2_Dobble/stack.c +++ b/I2_Dobble/stack.c @@ -15,6 +15,10 @@ StackNode *push(StackNode *stack, void *data) { StackNode *newNode; newNode = (StackNode *)malloc(sizeof(StackNode)); + if (!newNode) + printf("Speicherfehler: nicht genug Speicher"); + return stack; + newNode->data = data; // ,-→ bedeutet Liste war leer - das neue Element hat keinen Nachfolger (next = NULL)