Learn how to declare, initialize, and dereference pointers.
A pointer is a variable whose value is the memory address of another variable. Every variable in your program is stored at a specific location in the computer's memory, and this location has a unique address. A pointer simply holds that address. To declare a pointer, you use the asterisk (`*`) symbol. For example, `int* ptr;` declares a pointer named `ptr` that is intended to point to an integer. To make a pointer point to a variable, you use the address-of operator (`&`). For example, if you have `int number = 10;`, you can make `ptr` point to `number` with the statement `ptr = &number;`. Now, `ptr` holds the memory address of the `number` variable. The real power of pointers comes from the dereference operator, which is also the asterisk (`*`). When used on a pointer variable, it retrieves the value stored at the memory address the pointer is holding. So, `*ptr` would evaluate to `10`. You can use this to both read and modify the original variable's value. For instance, `*ptr = 20;` would change the value of `number` to `20`. It's crucial to initialize pointers before using them. An uninitialized pointer contains a garbage address and dereferencing it can crash your program. A good practice is to initialize pointers to `nullptr` (a C++11 keyword) if they don't point to a valid memory location yet.