1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ADT - destroyQueue; count vs null pointer

Discussion in 'C' started by Sorin, Sep 5, 2010.

  1. Sorin

    Sorin New Member

    Joined:
    Sep 5, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    When writing the destroyQueue function for my queue ADT, is there really that much of a difference in using

    Code:
    while(queue->count)
    as opposed to

    Code:
    while(queue->front != NULL)
    for the control statement of the loop that steps through the queue and destroys it? Using the assumption that the rest of the code and functions are bug free, and that the queue counts and next pointers are working correctly to facilitate those conditions. I don't see a difference, but then, I'm just a student and may not be seeing some sort of subtle potential pitfall.
     

Share This Page