How to Create Stack in Turbo C
  • How to Create Stack in Turbo C
  • 1 Comment sorted by


  • #include
    #include
    int q[10];
    int front=0;
    int rear=0;
    void Enque(int x)
    {
    if((front==1&&rear==10)||(front==rear+1)
    {
    printf(Queue is full");
    return;
    }
    if(front==0)
    {
    front=1;
    rear=2;
    }
    else fi(rear==10)
    {
    rear=1;
    }
    else
    {
    rear++;
    }
    q[rear]=x;
    }
    int dequeue()
    {
    int x;
    if(front==0)
    {
    printf("Queue Empty");
    retun(NULL);
    }
    else if(front==10)
    {
    front=1;
    }
    else
    {
    front++;
    }
    return(x);
    }
    main()
    {
    enqueue(15);
    enqueue(10);
    enqueue(11);
    clrscr();
    printf("\n%d",dequeue());
    printf("\n%d",dequeue());
    printf("\n%d",dequeue());
    getch();
    }



Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative