PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] isEmptyD() on null pointers
Date: Thursday, 02 Apr 2020, 07:37:11


    > Message Posted By: Unknown
    >
    > For isEmptyD(Deque *d), should this return true if d or *d are null?
    > Because then the deque wouldn't exist, but then it would be empty in a
    > sense, so I'm confused if it should return true or false in these cases.

If d is NULL, isEmptyD() should return false.

If *d is NULL, whether or not isEmptyD() should return
false depends how your implementation represents the
empty Deque, which could be with the NULL pointer or a
pointer to a struct containing two empty stacks or ... .

--Stan-
PREV INDEX NEXT