Author: Stan Eisenstat
Subject: Re: [Cs223] Question about typedef
Date: Saturday, 14 Mar 2020, 07:13:50
> Message Posted By: Unknown
>
> I have a question about an example in Professor Aspnes' notes (page 210).
>
> If you have the following two lines:
> typedef struct elt *Stack;
> Stack *s;
>
> Is 's' a pointer to a pointer to a elt struct or is it simply a pointer to
> a elt struct?
The declaration
typedef struct elt *Stack;
says that a variable of type Stack is a pointer to a
struct elt. Similarly, The declaration
Stack *s;
says that the type of *s is Stack. Thus *s is a pointer
to a struct elt, so that s itself is a pointer to a
pointer to a struct elt.
--Stan-
PREV
INDEX
NEXT