PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs223] Deque.h struct pointer
Date: Friday, 03 Apr 2020, 08:09:08


    > Message Posted By: Unknown
    >
    > Since
    >
    >  typedef struct deque *Deque;
    >
    > is a pointer and Deque.h includes lines like
    >
    >  bool isEmptyD (Deque *d);
    >
    > it means we have a pointer to a pointer and need to dereference it to reference struct variables
    >
    >  (*d)->head
    >
    > Is this right? Is there an easier way of getting around this?

Correct.

You could declare

  Deque *dp = *d;

and use

  dp->head

above if you think this is easier.

--Stan-
PREV INDEX NEXT