AfanasevGad7

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/AfanasevGad7
Log | Files | Refs

commit 0ddc9530881bc7c1a76ac0ad5f053b766e3937c0
parent eb468a4b268de11bab8acdc125ea480bd98078fb
Author: Plat <plat@stellar-nexus.ru>
Date:   Thu, 23 Oct 2025 18:51:42 +0000

Fixed segfault in init

Diffstat:
Mfinal_solution.cpp | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/final_solution.cpp b/final_solution.cpp @@ -50,7 +50,13 @@ int main() { Node* init(int val) { - Node n = { val, NULL, NULL }; + Node *n = malloc(sizeof(Node)); + if (Node == NULL) + return NULL; + + n->val = val; + n->left = NULL; + n->right = NULL; return &n; }