🚩 Quick Explanation

  1. Variables and Memory

    int x = 10; // box named x stores 10
    
  2. Pointers ( and &)

    int x = 10;
    int* p = &x;   // p stores the address of x
    *p = 20;       // changes the value at that address → x becomes 20
    
  3. References (&)

    int y = 5;
    int& ref = y; // ref is another name for y
    ref = 15;     // changes y to 15
    

⚖️ Key difference:


📝 Practice Problems (in increasing difficulty)

  1. Basics

  2. Modifying Values

  3. Pointers and Functions

  4. References and Functions

  5. Challenge

Problem from Hackerrank:

Pointer | HackerRank