From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/language%2Ffile_scope.html | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 devdocs/c/language%2Ffile_scope.html (limited to 'devdocs/c/language%2Ffile_scope.html') diff --git a/devdocs/c/language%2Ffile_scope.html b/devdocs/c/language%2Ffile_scope.html new file mode 100644 index 00000000..1e49b1cf --- /dev/null +++ b/devdocs/c/language%2Ffile_scope.html @@ -0,0 +1,27 @@ +

File scope

If the declarator or type specifier that declares the identifier appears outside of any block or list of parameters, the identifier has file scope, which terminates at the end of the translation unit.

+

So, placement of an identifier's declaration (in a declarator or type specifier) outside any block or list of parameters means that the identifier has file scope. File scope of an identifier extends from the declaration to the end of the translation unit in which the declaration appears.

+

Example

+

Identifiers a, b, f, and g have file scope.

+
#include <stdio.h>
+ 
+int a = 1;
+static int b = 2;
+ 
+void f (void) {printf("from function f()\n");}
+static void g (void) {printf("from function g()\n");}
+ 
+int main(void)
+{
+    f();
+    g();
+ 
+    return 0;
+}
+/* end of this translation unit, end of file scope */

Possible output:

+
from function f()
+from function g()
+

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

+
-- cgit v1.2.3