Hi
Member 13041326
,
This line is wrong:
*next = NULL;
It should be:
next = NULL;
next
is a pointer to the next node; you want to point it to none (aka NULL) at the initialization (aka constructor).
*next
would mean the value stored at
next
.
next
is a pointer, and
*next
is the
node
(that
next
is pointing at). The erroneous line is trying to assign 0 (NULL is 0) to a
node
type which is wrong, hence this would definitely give a compile error (e.g. node = 0 is not possible).