📅 Date: Jan 20, 2026
🔥 Topic: Pointers (Address & Dereference)


📍 What is a Pointer?

Normal variables store data (like 10, 'A', "Sahil").
Pointers are special variables that store the Address of another variable.

Think of it like a Treasure Map. The map isn't the gold, but it shows you exactly where the gold is kept.

🔑 Two Magic Operators

  • & (Address-of): Tells you where a variable lives.
  • * (Dereference): Goes to that address and grabs the value.

💻 Day 20 Code: Hacking Memory

#include <iostream>
using namespace std;

int main() {
    int num = 100;
    
    // 'ptr' is a pointer that holds the address of 'num'
    int *ptr = #

    cout << "Value of num: " << num << endl;
    cout << "Address of num (&num): " << &num << endl;
    
    cout << "Pointer stores: " << ptr << endl;
    cout << "Value at Pointer (*ptr): " << *ptr << endl;

    return 0;
}

💭 Thoughts

The syntax int *ptr declares a pointer, while *ptr (without int) accesses the value. Confusing at first, but powerful. I am literally touching the RAM addresses now.