c - What is the difference between static int a and int a? -


possible duplicate:
difference between 'global' , 'static global'

what difference between statements 1 , 2 :-

#include <stdio.h> //in global declaration area   static int a; // 1. int b;        // 2. 

thanks help.

a static global variable local translation unit defined in. so, if define static int a; in 2 different translation units, create 2 independent variables. if define non-static global variable int b; in 2 translation units, experience linker error (but can use extern int b; in 1 of 2 translation units tell linker should use global variable other translation unit).


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -