From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/c/language%2Fstatic_storage_duration.html | 32 ----------------------- 1 file changed, 32 deletions(-) delete mode 100644 devdocs/c/language%2Fstatic_storage_duration.html (limited to 'devdocs/c/language%2Fstatic_storage_duration.html') diff --git a/devdocs/c/language%2Fstatic_storage_duration.html b/devdocs/c/language%2Fstatic_storage_duration.html deleted file mode 100644 index 2ca1a227..00000000 --- a/devdocs/c/language%2Fstatic_storage_duration.html +++ /dev/null @@ -1,32 +0,0 @@ -

Static storage duration

An object whose identifier is declared without the storage-class specifier _Thread_local, and either with external or internal linkage or with the storage-class specifier static, has static storage duration. Its lifetime is the entire execution of the program and its stored value is initialized only once, prior to program startup.

-

Notes

Since its stored value is initialized only once, an object with static storage duration can profile the invocations of a function.

-

The other use of the keyword static is file scope.

-

Example

#include <stdio.h>
- 
-void f (void)
-{
-    static int count = 0;   // static variable   
-    int i = 0;              // automatic variable
-    printf("%d %d\n", i++, count++);
-}
- 
-int main(void)
-{
-    for (int ndx=0; ndx<10; ++ndx)
-        f();
-}

Output:

-
0 0
-0 1
-0 2
-0 3
-0 4
-0 5
-0 6
-0 7
-0 8
-0 9
-

- © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
- https://en.cppreference.com/w/c/language/static_storage_duration -

-
-- cgit v1.2.3