summaryrefslogtreecommitdiffhomepage
path: root/c.html.markdown
diff options
context:
space:
mode:
authorLevi Bostian <levi.bostian@gmail.com>2013-11-24 14:17:32 -0600
committerLevi Bostian <levi.bostian@gmail.com>2013-11-24 14:17:32 -0600
commite63232d2de1e2058dd381fe1094c7f775f2e3eb8 (patch)
treedeec47b8be8804cd8a9da8b8e7e354e1081593f9 /c.html.markdown
parent38de481179484d597d44fa934f87a5f21ebfaa6c (diff)
Add static description to C.
Diffstat (limited to 'c.html.markdown')
-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);