PREV INDEX NEXT

Author: Unknown
Subject: testDeque on nonexistent Deque 2
Date: Saturday, 04 Apr 2020, 22:20:05

Hi Professor Eisenstat,

I saw the posting yesterday (4/3):

> If I run ./testDeque with my ADT and enter the command "IA" before
> anything (checking if deque A is empty when deque A doesn't exist), I get
> a seg fault. Is this something to worry about?

and realized I too am having the same error. However, I do not know how to correct such a problem. I can only think of checking whether or not the passed in argument is NULL or checking the head and tail fields, but I cannot think of any method of validating whether or not the argument exists (i.e. a has never been initialized).

Could you shed some light on how we could possibly detect this type of invalid argument where the deque is nonexistent at the time of calling it in a function?

Thank you!
PREV INDEX NEXT