Advanced C++ References and Pointers
1. Basics of Pointers A pointer is a variable that stores a memory address. Pointer definition and initialization:<span><span>int *p = &a;</span></span> Pointer operations:<span><span>++</span></span>, <span><span>–</span></span>, <span><span>+n</span></span>, <span><span>-n</span></span> The relationship between pointers and arrays: the name of the array is the address of the first element. Exercise: Swap Two Values After swap1: x=10, y=20 After swap2: x=20, … Read more