标签:
A. extern函数
1 //define a extern function perfectly
2 void extern testEx()
3 {
4     printf("my.c ==> call external function\n");
5 }
6  
1 //declare the function first to apply the C99 compiler standard
2 void extern testEx();
3 
4 int main(int argc, const char * argv[]) {
5     testEx();
6     return 0;
7 }
1 static void one()
2 {
3     printf("one.c ==> one()\n");
4 }
5  
 1 //first solution, define the variable before calling
 2 //int a;
 3 
 4 //declare a variable
 5 extern int a;
 6 
 7 int main(int argc, const char * argv[]) {
 8    
 9     a = 10;
10    
11     return 0;
12 }
13 
14 //define the variable
15 int a;
1 void test()
2 {
3     extern int b;
4     printf("b = %d\n", b);
5 }
6 
7 int b = 3;
1 void test()
2 {
3     static int e = 10;
4     e++;
5     printf("e = %d\n", e);
6 }
标签:
原文地址:http://www.cnblogs.com/wvqusrtg/p/4501006.html