Veda Bites are swipeable micro-lessons — each one teaches exactly one
idea. Here's a taste from this kit; the app has the full deck.
💡 Key Idea
What is a Pointer?
A variable that stores a memory address.
A pointer is a variable that holds the memory address of another variable. Instead of storing a value directly, it stores the location where the value is kept. This allows indirect access to data, enabling dynamic memory management and efficient array handling.
↳ Pointers store addresses, not values, enabling indirect data access.
📖 Definition
Pointer Declaration and Initialization
Declare with * and initialize with &.
A pointer is declared by specifying the type of data it points to, followed by an asterisk. It is initialized with the address of a variable using the `&` operator.
↳ Use `type *ptr;` to declare and `&variable` to initialize.
💡 Key Idea
Dereferencing a Pointer
Access the value at the address.
The dereference operator `*` is used to access the value stored at the address held by a pointer. This allows reading or modifying the original variable indirectly.
↳ `*ptr` gives the value at the address, enabling read and write.