mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-25 06:49:36 +03:00
Update queue.c (#622)
This commit is contained in:
parent
af6de4b7d4
commit
6f385ed4a4
@ -52,14 +52,14 @@ void enque(int x)
|
||||
{
|
||||
if (head == NULL)
|
||||
{
|
||||
head = (struct node *)malloc(1 * sizeof(struct node));
|
||||
head = (struct node *)malloc(sizeof(struct node));
|
||||
head->data = x;
|
||||
head->pre = NULL;
|
||||
tail = head;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp = (struct node *)malloc(1 * sizeof(struct node));
|
||||
tmp = (struct node *)malloc(sizeof(struct node));
|
||||
tmp->data = x;
|
||||
tmp->next = tail;
|
||||
tail = tmp;
|
||||
|
Loading…
Reference in New Issue
Block a user