Sudheergv Sudheergv - 1 year ago 52
C Question

How to understand pointer 'next' in a linked list structure?

struct Node
int a;
struct Node *next;

How will
address point dynamically? I read
returns address value — is that right?
Please explain
struct Node *next
. Is this the default way of declaring a pointer in a struct?

Answer Source

Yes your declaration is correct. To understand it, see it this way. When the compiler wants to know what kind of pointer it should compile the strcut's next field. The declaration type you gave is used. Since the compiler already parses the structure before coming to this line. It understands that the next pointer type is also of same structure type. I hope this helps in your understanding.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download