Storage Duration
How long an object lives: automatic (block), static (whole program), allocated (malloc/free) or thread (`_Thread_local`).
Easy
A static local keeps its value between calls: static int calls = 0; calls++;.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.