a bug #26

Closed
opened 2026-01-29 15:01:01 +00:00 by claunia · 2 comments
Owner

Originally created by @zphiliam on GitHub (Feb 27, 2019).

C/data_structures/stack.c

I think there is a bug !

the node->next always equal to NULL

Originally created by @zphiliam on GitHub (Feb 27, 2019). C/data_structures/stack.c I think there is a bug ! the `node->next` always equal to `NULL`
Author
Owner

@itaikla commented on GitHub (Jun 7, 2019):

You are right, node->next is always equal to NULL, but it's not a bug, the author just did not use it.
Because you actually can implement a stack with only one pointer to next node (prev or node in that case is a semantic issue), like singly linked list.

@itaikla commented on GitHub (Jun 7, 2019): You are right, node->next is always equal to NULL, but it's not a bug, the author just did not use it. Because you actually can implement a stack with only one pointer to next node (prev or node in that case is a semantic issue), like singly linked list.
Author
Owner

@ashwek commented on GitHub (Jun 8, 2019):

@zphiliam thank you for reporting the issue.
well node->next being NULL is not a bug, but due to this

b1fed3cf3e/data_structures/stack.c (L111)

this line becomes useless.

@ashwek commented on GitHub (Jun 8, 2019): @zphiliam thank you for reporting the issue. well ``node->next`` being ``NULL`` is not a bug, but due to this https://github.com/TheAlgorithms/C/blob/b1fed3cf3e9f693a653750ec4e402a6ff75f9095/data_structures/stack.c#L111 this line becomes useless.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#26