mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-21 21:11:57 +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;
|
||||
@ -92,4 +92,4 @@ int deque()
|
||||
/**
|
||||
* Returns the size of the Queue.
|
||||
*/
|
||||
int size() { return count; }
|
||||
int size() { return count; }
|
||||
|
Loading…
Reference in New Issue
Block a user