1. Home
  2. Computer Science MCQs
  3. C Programming
  4. What is special about a static local variable declared…

Added 30 Nov -0001

What is special about a static local variable declared inside a function?

  1. It is stored in the caller's frame
  2. It becomes visible in other files
  3. It is reset on every function entry
  4. It retains its value between calls Correct answer

Correct answer

D. It retains its value between calls

16 views

MCQSEXAM

Explanation

A static local has static storage duration, so its value persists across calls although its name stays block-scoped.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C Programming MCQs

Practise all C Programming MCQs

Similar MCQs