Interview Question

What is static keyword?

static can control linkage, storage duration, or array-parameter requirements.

💡 Concept ✅ Quick Revision ⚙ C

Answer

static has different effects depending on where it appears. • At file scope, it gives an identifier internal linkage. • For a block-scope object, it gives static storage duration while keeping block scope. • In an array function parameter, static can express a minimum element requirement.

💡 C Example

static unsigned int calls; void record_call(void) { static unsigned int local_calls; ++calls; ++local_calls; }

⚡ Quick Revision

static can control linkage, storage duration, or array-parameter requirements.