Skip to main content
C Output Prediction Medium +20 XP

Pointer Dereference

What is the output?

CRead-only
int a = 10;
int *p = &a;
*p = 20;
printf("%d", a);

What is the output?

Show answer and explanation

Answer: 20

p points to a. *p = 20 dereferences p and sets a's value to 20.

Hint: *p dereferences the pointer.

What this challenge tests

Output Prediction in C: pointers, memory.

Related challenges