summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c.html.markdown7
1 files changed, 7 insertions, 0 deletions
diff --git a/c.html.markdown b/c.html.markdown
index b4a874d3..7b95c969 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -469,6 +469,13 @@ void testFunc() {
extern int i; //i here is now using external variable i
}
+//if external variable should only be visible to functions in the source file
+// they are declared in, use static:
+static int i = 0; //other source files using testFunc() cannot access variable i
+void testFunc() {
+ extern int i;
+}
+
/*
char c[] = "This is a test.";
str_reverse(c);