Update queue.c (#622)

This commit is contained in:
devraj4522 2020-10-01 19:58:19 +05:30 committed by GitHub
parent af6de4b7d4
commit 6f385ed4a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,14 +52,14 @@ void enque(int x)
{ {
if (head == NULL) if (head == NULL)
{ {
head = (struct node *)malloc(1 * sizeof(struct node)); head = (struct node *)malloc(sizeof(struct node));
head->data = x; head->data = x;
head->pre = NULL; head->pre = NULL;
tail = head; tail = head;
} }
else else
{ {
tmp = (struct node *)malloc(1 * sizeof(struct node)); tmp = (struct node *)malloc(sizeof(struct node));
tmp->data = x; tmp->data = x;
tmp->next = tail; tmp->next = tail;
tail = tmp; tail = tmp;
@ -92,4 +92,4 @@ int deque()
/** /**
* Returns the size of the Queue. * Returns the size of the Queue.
*/ */
int size() { return count; } int size() { return count; }