Final explanation ... i hope
ok im starting to understand maybe parts of this. I added comments in here explaining what i could but there are many parts that im not exactly sure. If anyone would be willing to replace my comments with some kind of explanation i believe i will understand this. If not thanks for your help and ill try to figure it out.
Code:
struct node {
int x;
node *next;
};
int main()
{
node *root; // these are 2 pointers to the structure
node *conductor;
root = new node; // it uses a ptr to make a starting point
root->next = 0; // Need more explanation
root->x = 12; // Need more explanation
conductor = root; // sets the other ptr = the ptr conductor
if ( conductor != 0 ) { // if the conductor not = to 0 ... how does it know that? never defined?
while ( conductor->next != 0) // Need more explanation
conductor = conductor->next; // Need more explanation
}
conductor->next = new node; // Need more explanation
conductor = conductor->next; // Need more explanation
conductor->next = 0; // Need more explanation
conductor->x = 42; // Need more explanation
}