Deque using linked list

/*  Program to implement dequeue using linked list  */
    #include
    #include
    #define new1 (nd *)malloc(sizeof(nd))
    typedef struct deque
    {
        int info;
        struct deque *next;
    }nd;
    void display(nd *ptr)
    {   
        if(ptr==NULL)
            printf("\nQueue is empty...\n");
        else
        {
            printf("\nQueue  :   ");
            while(ptr!=NULL)
            {
                printf(" %d --> ",ptr->info);
                ptr=ptr->next;
            }
            printf("\b\b\b\b   ");
            printf("\n");
        }
    }
    void insfront(nd **ptr)
    {
        if(*ptr==NULL)
        {
            *ptr=new1;
            printf("\nEnter the element : ");
            scanf("%d",&(*ptr)->info);
            (*ptr)->next=NULL;
        }
        else
        {
            nd *t;
            t=new1;
            printf("\nEnter the element : ");
            scanf("%d",&t->info);
            t->next=*ptr;
            *ptr=t;
        }
    }
    void insrear(nd **ptr)
    {
        nd *c=*ptr;
        if(*ptr==NULL)
        {
            *ptr=new1;
            printf("\nEnter the element : ");
            scanf("%d",&(*ptr)->info);
            (*ptr)->next=NULL;
        }
        else
        {
            nd *t;
            t=new1;
            printf("\nEnter the element : ");
            scanf("%d",&t->info);
            while(c->next!=NULL)
                c=c->next;
            t->next=NULL;
            c->next=t;
        }
    }
    void delfront(nd **ptr)
    {
        nd *c=*ptr,*t=*ptr;
        if(*ptr==NULL)
            printf("\nQueue is empty...");
        else if(t->next==NULL)        // If queue contains single node
        {
            *ptr=NULL;
            free(t);
        }
        else
        {
            *ptr=c->next;
            free(c);
        }
    }
    void delend(nd **ptr)
    {
        nd *c=*ptr,*t=*ptr,*p;
        if(*ptr==NULL)
            printf("\nQueue is empty...");
        else if(t->next==NULL)         // If queue contains single node
        {
            *ptr=NULL;
            free(t);
        }
        else
        {
            while(c->next!=NULL)
            {
                p=c;
                c=c->next;
            }
            p->next=NULL;
            free(c);
        }
    }   
main()
{
    int n;
    nd *h;
    h=NULL;
    printf("\nProgram to implement dequeue using linked list :\n");
    int ch1,ch2,ch3,ch4,ch5,ch6,ch7;
    do
    {
    printf("\n[1] Create input restricted queue \n[2] Create output restricted queue ");
    printf("\n[3] Quit from program \n");
    printf("\nEnter your choice : ");
    scanf("%d",&ch1);
    switch(ch1)
    {
        case 1:
            do
            {
            printf("\n[1] Insert at front restricted \n[2] Insert at end restricted ");
            printf("\n[3] Quit to previous menu \n");
            printf("\nEnter your choice : ");
            scanf("%d",&ch2);
            switch(ch2)
            {
                case 1:
                    do
                    {
                    printf("\n[1] Insert at end      [2] Delete from front ");
                    printf("\n[3] Delete from end    [4] Quit to previous menu \n");
                    printf("\nEnter your choice : ");
                    scanf("%d",&ch3);
                    switch(ch3)
                    {
                        case 1:
                            insrear(&h);
                            display(h);
                            break;
                        case 2:
                            delfront(&h);
                            display(h);
                            break;
                        case 3:
                            delend(&h);
                            display(h);
                            break;
                        case 4:
                            break;
                        default:printf("\nEnter correct choice..\n");
                            break;
                           
                    }
                    }while(ch3!=4);
                    break;
                case 2:   
                    do
                    {
                    printf("\n[1] Insert at front    [2] Delete from front ");
                    printf("\n[3] Delete from end    [4] Quit to previous menu \n");
                    printf("\nEnter your choice : ");
                    scanf("%d",&ch4);
                    switch(ch4)
                    {
                        case 1:
                            insfront(&h);
                            display(h);
                            break;
                        case 2:
                            delfront(&h);
                            display(h);
                            break;
                        case 3:
                            delend(&h);
                            display(h);
                        case 4:
                            break;
                        default:printf("\nEnter correct choice...\n");
                            break;
                    }
                    }while(ch4!=4);
                    break;
                case 3:
                    break;
                default:printf("\nEnter correct choice...\n");
                    break;
            }
            }while(ch2!=3);
            break;
        case 2:
            do
            {
            printf("\n[1] Delete at front restricted  [2] Delete at end restricted ");
            printf("\n[3] Quit to previous menu \n");   
            printf("\nEnter your choice : ");
            scanf("%d",&ch5);
            switch(ch5)
            {
                case 1:   
                    do
                    {
                    printf("\n[1] Insert at front    [2] Insert at end ");
                    printf("\n[3] Delete from end    [4] Quit to previous menu \n");
                    printf("\nEnter your choice : ");
                    scanf("%d",&ch6);
                    switch(ch6)
                    {
                        case 1:
                            insfront(&h);
                            display(h);
                            break;
                        case 2:
                            insrear(&h);
                            display(h);
                            break;
                        case 3:
                            delend(&h);
                            display(h);
                            break;
                        case 4:
                            break;
                        default:printf("\nEnter correct choice...\n");
                            break;
                    }
                    }while(ch6!=4);
                    break;
                case 2:
                    do
                    {
                    printf("\n[1] Insert at front      [2] Insert at end ");
                    printf("\n[3] Delete from front      [4] Quit to previous menu \n");
                    printf("\nEnter your choice : ");
                    scanf("%d",&ch7);
                    switch(ch7)
                    {
                        case 1:
                            insfront(&h);
                            display(h);
                            break;
                        case 2:
                            insrear(&h);
                            display(h);
                            break;
                        case 3:
                            delfront(&h);
                            display(h);
                            break;
                        case 4:
                            break;
                        default:printf("\nEnter correct choice...\n");
                            break;
                    }
                    }while(ch7!=4);
                    break;
                case 3:
                    break;
                default:printf("\nEnter correct choice...\n");
                    break;
            }
            }while(ch5!=3);
        case 3:
            break;
        default:printf("\nEnter correct choice ... \n");
            break;
    }
    }while(ch1!=3);
}  

Top