Pointers & Memory Management

Pointers & Address Operator (&) Explained

Learn what pointers are, how they store hexadecimal RAM addresses, and dereferencing values.

1. What is a Pointer? A pointer is a variable that stores the RAM MEMORY ADDRESS of another variable!

  • โ–ธ& (Address-Of Operator): Returns the RAM address of a variable (&num -> 0x7ffe4a80).
  • โ–ธ* (Dereference Operator): Fetches or modifies the value inside that RAM address!
#include <stdio.h>

int main() { int num = 100; int *ptr = &num;

printf("Value num = %d\n", num); printf("Value via *ptr = %d\n", *ptr);

*ptr = 250; printf("New Value of num = %d\n", num); return 0; } ```

๐Ÿง 

Interactive RAM & Pointer Visualizer

Click any memory block to see how C allocates variables in RAM.

Modify num:
0x7ffe4a804 bytes
int num42
0x7ffe4a848 bytes
int* ptr0x7ffe4a80
โšก Points to: 0x7ffe4a80
0x7ffe4a8c1 byte
char grade'A'
0x7ffe4a904 bytes
float cgpa8.95

๐Ÿ“ Variable `num` is stored at RAM address 0x7ffe4a80. Its value is currently 42. Calling &num returns this memory address!

C Runner