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 = #
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