Here's how it works:
1. Wave action: Waves constantly crash against the coastline, eroding the cliffs and headlands.
2. Headland erosion: The softer rock in the headland is eroded faster than the harder rock, creating caves and arches.
3. Arch collapse: The arch eventually collapses, leaving an isolated rock column standing – a stack.
4. Further erosion: The stack continues to be eroded by waves, eventually collapsing into the sea.
So, while deposition plays a role in building up coastlines, stacks are a product of the erosive power of waves.