What is the lifetime of a static variable declared in a user-defined function?

108. What is the lifetime of a static variable declared in a user-defined function?

  1. Within the function only
  2. Within the main function only
  3. Whole program
  4. None of the above

Answer: C) Whole program

Explanation:

The lifetime of a static variable is in the whole program. But its scope is within the function only.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.