- #1
bd411
- 39
- 0
Homework Statement
Hello, just having a bit of trouble understanding this bit of code:
typedef int Item;
struct Node {
Item data;
Node* next;
};
typedef Node* NodePtr
NodePtr hdlist = NULL;
Homework Equations
None.
The Attempt at a Solution
I understand that typedef is used to assign alternative names to existing types. So Item is now (int). Node is the name of the structure and inside the structure we have Item data = int data basically. What I'm not sure about is Node* next.
As far as I am aware, pointers are declared with the int* ptr method. This is a pointer ptr of type int. However does this mean that next is a pointer of type Node? But Node is simply the name of the structure?