c++ - Self structure and pointers in linklist -


i have few confusion in understanding linked list. here full code.

struct node {     int data;     node *next; }; node *head;    main() { head =new node; head -> data=5; head -> next=null;  node *ptr=new node; ptr -> data=6; head -> next=ptr; ptr -> next= null;  } 

1) self defined struct node pointer in structure made hold address of structure of same type, according link , size of node *next?

2) when make 2nd node ptr, in linked list assign address of 2nd node address part of 1st node, can assign & sign how can head -> next=ptr;

i sorry ask basic things think mixed concepts of pointers. please me understand that

next pointer, has size of pointer, means 8b in 64-bit architecture. of course, can see simple sizeof(struct node *).


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -