-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Description
In the queue model (path : data_structures/queue/queue.c). dequeue won't work due to a simple bug on the last if clause of it. take a look:
C/data_structures/queue/queue.c
Line 65 in b1a8da6
| head->next = NULL; |
as you can see if we have only one variable in our queue on dequeue the HEAD will be null and assigning NULL to NULL->next will cause a segmentation fault.
Expected behavior
not to cause fault =)
Actual behavior
case segmentation fault
Possible fix
simply put line 65 in its above clause
Steps to reproduce
- call create
- enqueue anything you like
- dequeue it
Context
It just don't work =)
Additional information
No response