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.
Loading...
Related Quiz
- Which searching algorithm is typically the most straightforward to implement?
- When defining a bit field, the data type ________ is typically used.
- When an array is passed to a function, it is actually passing the ________ of the first element.
- What is the time complexity of the bubble sort algorithm in the best case?
- When you increment a pointer in C, it advances the pointer by the size of the type to which it points, which is known as ________.