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
Post a Comment