From e63232d2de1e2058dd381fe1094c7f775f2e3eb8 Mon Sep 17 00:00:00 2001 From: Levi Bostian Date: Sun, 24 Nov 2013 14:17:32 -0600 Subject: Add static description to C. --- c.html.markdown | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- cgit v1.2.3