Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/articles/c-tutorials/)
-   -   Queue implementation through linked list (http://www.go4expert.com/articles/queue-implementation-linked-list-t1279/)

Awais 9Dec2009 14:29

Re: Queue implementation through linked list
 
I want queue implementation using linked list with Classes
By the way Nice work

tehdoughnut 14Mar2012 11:57

Re: Queue implementation through linked list
 
This code has an error. If the list empties all of the way then rear doesn't point to null when it should. The delete function should be:

Code:

void qdelete(node **front,node **rear)
{
    node *delnode;      /* Node to be deleted */
    if((*front)==NULL && (*rear)==NULL)
        printf("\nQueue is empty to delete any element\n");
    else
    {
        delnode=*front;
        (*front)=(*front)->next;
        if((*front) == NULL)
            (*rear) = NULL;

        free(delnode);
    }
}



All times are GMT +5.5. The time now is 17:42.