c / beginner
Snippet
The Address-of Operator (&)
In C, every variable is stored in a specific memory location. The ampersand (&) operator retrieves the memory address of a variable.
snippet.c
1
2
3
int speed = 80;printf("Value: %d\n", speed);printf("Memory Address: %p\n", (void*)&speed);
Breakdown
1
&speed
The address-of operator returns the location in memory where 'speed' is stored.
2
%p
The format specifier used to print a memory address (pointer).