Skip to content

Pointers and nodes

Read · 1 of 4

A pointer is an address

Node* p holds the address of a Node, not a Node itself. &b gives b's address, and p->val reads the val of the Node that p points to.

Give each node a next pointer to the following node, and you get a chain: a linked list. nullptr means "points nowhere" and marks the end.