Veda Bites are swipeable micro-lessons — each one teaches exactly one
idea. The bites below come from this kit — swipe through them in the app.
💡 Key Idea
A Pointer Stores an Address, Not a Value
Pointers point — they don't hold the value.
A pointer is a variable whose value is the memory address of another variable. It lets you access that variable indirectly.
↳ Pointer = address holder; * reads/writes the value at that address.
📖 Definition
Declaring and Initializing a Pointer
Star declares, ampersand assigns.
↳ Use `type *name = &variable;` to declare and point in one line.
💻 Code Example
Full Working Example: Read and Modify via Pointer
Change x without touching x.
Writing `*p = 20` changes the value at the address p holds — which is x itself.
↳ Dereferencing on the left side of `=` writes to the original variable.
⚖️ Comparison
Variable vs Pointer: What's Stored
Value vs address — know the difference.
↳ A variable holds data; a pointer holds where the data lives.
⚙️ Process
How Dereferencing Works Step-by-Step
Follow the arrow to the value.
↳ Dereferencing follows the stored address to reach the original variable.
⚠️ Common Mistake
Uninitialized Pointers Are Dangerous
Wild pointers crash programs.
↳ Never dereference a pointer that doesn't point to valid memory.
⚠️ Common Mistake
Don't Confuse `*p = &x` with `p = &x`
One star changes everything.
↳ Assign addresses to the pointer itself (no star); use star only to reach the value.
🛠️ Application
Why C Uses Pointers: Swap Two Numbers
Swap without return values.
Passing addresses lets a function modify the caller's variables directly.
↳ Pointers enable functions to modify caller data — a key C pattern.
⭐ Important Fact
Pointer Size Is Fixed per Platform
All pointers are the same size.
On a 64-bit system, every pointer (int*, char*, float*) is typically 8 bytes; on 32-bit systems, 4 bytes — regardless of the type it points to.
↳ Pointer size depends on the architecture, not the pointed-to type.
💡 Key Idea
Pointers and Arrays Are Closely Linked
An array name is basically an address.
`arr[i]` is equivalent to `*(arr + i)` — array indexing is pointer arithmetic in disguise.
↳ Array name decays to a pointer to its first element.
⚙️ Process
Pointer Arithmetic: Move by Type Size
p+1 doesn't mean +1 byte.
↳ Pointer arithmetic scales by the size of the pointed-to type.
🚫 Warning
NULL vs Dangling Pointers
Two ways pointers go bad.
↳ Check for NULL; never use a pointer after its target is freed.
🎯 Exam Tip
Exam Favorite: Output of Pointer Code
Trace addresses, not just values.
↳ Most pointer exam questions test whether you can trace address vs value.
🧠 Memory Trick
Remember: & = 'Address Of', * = 'Value At'
Ampersand asks, star answers.
`&` = Address Of (A&O). `*` = Value At (VA). Say it aloud: 'A&O gives the address, VA gives the value.'
↳ & gets the address; * gets the value at that address.
✅ Best Practice
Always Initialize and Check Pointers
Safe pointers save hours of debugging.
↳ Disciplined initialization prevents most pointer bugs.