What is the lifetime of a static variable in a C program?

  • Limited to the function it's defined in
  • Same as the program's runtime
  • Until the function exits
  • Until the program exits
The lifetime of a static variable in C is the same as the program's runtime. It retains its value between function calls and persists until the program terminates.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *