๐Ÿ“… Date: Jan 22, 2026
๐Ÿ”ฅ Topic: Pointer Arithmetic (+, -, ++, --)


๐Ÿƒ‍♂️ How Pointers Move

If I have a pointer at address 1000 and I do ptr++, where does it go?
It depends on the Type.

  • int (4 bytes): 1000 → 1004
  • char (1 byte): 1000 → 1001
  • double (8 bytes): 1000 → 1008

๐Ÿ’ป Day 22 Code: Iterating without Index

#include <iostream>
using namespace std;

int main() {
    int arr[] = {10, 20, 30, 40};
    int *ptr = arr; // Points to start

    cout << "Traversing Array using Pointer:" << endl;

    for(int i=0; i<4; i++) {
        cout << *ptr << " ";
        ptr++; // Jumps 4 bytes ahead to next integer
    }

    return 0;
}

⚠️ Danger Zone

If I increment the pointer too much, it will point to memory that doesn't belong to me. This can crash the program (Segmentation Fault).

⏭️ Next Up: Binary & Number Systems

Pointers showed me memory addresses (Hexadecimal). Now it's time to understand the language of computers deeply.
Starting tomorrow: Binary to Decimal Conversions & Bitwise Operations!