PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Deque vs deque
Date: Friday, 27 Mar 2020, 21:34:20


    > Message Posted By: Unknown
    >
    > I am a bit lost trying to understand the difference between Deque and
    > deque. ...

"deque" is the name of a struct; "Deque" is the name of
a data type that is a pointer to a struct deque.  You
may want to review the Queue.txt handout, which is also
available on the class web site

  https://zoo.cs.yale.edu/classes/cs223/doc/Queue.txt
=====

    >   ...  As far as understand it, deque consists of two pointers to two
    > headless single-linked lists (or another similar implementation). ...

That is one implementation.
=====

    >                                                              ...  But then
    > why do we use Deque (which is a pointer to deque) as an argument for
    > functions in Deque.c? ...

The implementation may need to change the value of the
Deque variable in the calling function as well as report
the status of the operation, but only one value can be
returned through the name of the function.  I chose the
status, which means the address of the Deque variable
must be the argument, not its value.
=====

    >                  ...  For example, why is the function declared as "bool
    > createD (Deque *d)" not "bool createD (deque *d)"? ...

Because Deque is the name of a data type, while
deque is the name of a struct.
=====

    >                                               ...  Why do we use a pointer
    > to a pointer to deque instead of just a pointer to deque?

See above.

--Stan-
PREV INDEX NEXT