C Pointers
Work with memory addresses.
C
#include <stdio.h>
int main(void) {
int score = 91;
int *pointer = &score;
printf("%d\n", *pointer);
return 0;
}Output
91
Explanation
A pointer holds an address. The & operator gets an address; * dereferences it. Only dereference a valid pointer.
Explore the dry run
Guided walkthroughReady
1
#include <stdio.h>2
int main(void) {3
int score = 91;4
int *pointer = &score;5
printf("%d\n", *pointer);6
return 0;7
}Follow the example
Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.
View the complete dry-run table
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| Store 91 in score. | score = 91 | — | |
| Store the address of score in pointer. | pointer = &score | — | |
| Dereference pointer to read score. | pointer = &score | 91 |