Pointer ( * and & )
Holds the address of a variable.
Syntax
type *p = &variable;
Description
& gives the ADDRESS of a variable; * accesses the VALUE at that address. Pointers are C's most powerful and demanding feature.
Example
Loading editor…
Expected output
10 20
When to use?
Passing data to a function by reference, dynamic memory, arrays.
Common mistakes
- ⚠️ & gets the address, * accesses the value — don't mix them up.
- ⚠️ Reading an uninitialized pointer (*p) causes a crash.