嵌入式C语言3.4 关键字---类型描述符

对内存资源存放位置的限定

1. auto

  默认值---分配的内存都是可读可写的

  auto int a; 

2. register

  register int a; 限制变量定义在寄存器上的修饰符 

  定义快速访问的变量,

  编译器会尽量的安排CPU的寄存器去寄存这个变量a,如果寄存器不足时,变量a还是会被放在存储器中。

  内存(存储器)            寄存器

3. static

  静态

  应用场景: 

    修饰3种数据

    (1) 函数内部的变量

      int fun()

      {

      int a ;   =====>>static int a;

      }

    (2)   函数外部的变量

      int a;===========>> static int a;

       int fun()

        {

        }

    (3) 函数的修饰符

      int fun();   =====》static int fun();

4. extern

5. volatile

猜你喜欢

转载自www.cnblogs.com/ivyharding/p/11094375.html