0

In Lecture 4, David uses this to declare a node struct:

typedef struct node
{
   int n;
   struct node *next;
}
 node;

However, in shorts after Lecture 4, Doug explicitly tells us that when declaring such linked structs we have to use temp names like this:

typedef struct node_temp
{
   int n;
   struct node_temp *next;
}
 node;

Are they both right and am I missing something?

1

The requirement is that you give the struct a name so you can use it in the declaration. Whether or not that is a different name isn't important. Both of those declarations are fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .