thanks a lot for help with stack, now I have written queue by myself.. But I have just one problem. When I'm adding just one item and I want to print it, program is printing this number in infinity. What's wrong with my push/print function?

```
#include <stdio.h>
#include <stdlib.h>
typedef struct Element Element;
typedef struct Element
{
    int value;
    Element* next;
} Element;

Element* first = NULL;
Element* last = NULL;

void pop();
void push(int x);
void printqueue();

int main()
{
    int x;
    int warunek;
    do
    {
        printf("\nMENU\n");
        printf("1. Push[1]\n2. Pop[2]\n3. Print[3]\n0. Wyjdz[0]\n");
        printf("Podaj warunek: ");
        scanf("%d", &warunek);
        switch(warunek)
        {
            case 1:
            {
                printf("Give a number: ");
                scanf("%d", &x);
                push(x);
            }
            break;
            case 2: pop();
            break;
            case 3: printqueue();
            break;
            default: printf("Bad value.\n");
        }
    }
    while(warunek != 0);
    return 0;
}

void push(int x)
{
    Element* pNewItem = (Element*)malloc(sizeof(Element));
    pNewItem->value = x;
    pNewItem->next = NULL;
    if(first == NULL && last == NULL)
    {
        first = last = pNewItem;
    }
    last->next = pNewItem;
    last = pNewItem;
}

void pop()
{
    Element* pNewItem = first;
    if(first == NULL)
        printf("Queue is empty.\n");
    else if(first == last)
        first = last = NULL;
    else
        first = first->next;
    free(pNewItem);
}

void printqueue()
{
    Element* temp = first;
    printf("\nContent of queue\n");
    while(temp != NULL)
    {
        printf("%d\n", temp->value);
        temp = temp->next;
    }
    printf("\n");
}

```