Reputation: 157
I am trying to make a struct Node, that links to other Nodes. in the code below
typedef struct Node{
Node *children[10];
}Node;
When i try and compile i get the error
Error unknown type name 'Node'
I'm pretty sure i should be able to assign a Node from inside the Struct Node. Can anyone explain why this isnt working.
Upvotes: 0
Views: 231
Reputation: 310930
Within the structure definition the name Node
is yet undefined. There is defined only the type specifier struct Node
. So write
typedef struct Node{
struct Node *children[10];
}Node;
Or you could write
typedef struct Node Node;
struct Node
{
Node *children[10];
};
Upvotes: 2