#include <stdio.h>
// 如果在不同源文件出现了同名的内部变量,那么这些变量将互不干扰
static int b;

// 用static修饰的全部变量,可以称为内部变量
static int a;

void testA() {
    printf("one.c中的a=%d\n", a);
}

 

  调用:

static int b;

void testA();

extern int a;

int main(int argc, const char * argv[])
{
    a = 10;
    
    testA();
    return 0;
}

int a;

 

相关文章:

  • 2021-09-29
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2021-05-27
  • 2021-06-30
  • 2021-07-06
  • 2021-12-13
  • 2021-07-29
  • 2022-12-23
相关资源
相似解决方案