zoukankan      html  css  js  c++  java
  • <标识符>

      限定符的作用是限定变量,而使被限定的变量具有特殊的属性,以达到我们变成的目的。通常有局部变量和全局变量,局部变量定义在函数内被,期生命周期在函数被调用的时间内;而全局变量定义在函数外部,其生命周期,贯穿始终。

      接着我们说说,在嵌入式底层开发,常用的限定符:static, volatile, extern。一下举例说明:

      volatile is typically used for hardware address and for data shared with other programs .告诉编译器,不要优化,因为,该变量可能在别处改变。

      //Module A

      int foo;    //Meant to be modified in this module only

      volatile int bar;  //Value can change unexpectedly outside of this module.

      //Module B

      extern int foo; //we can read this value defined in Module A,but should not modify it.

      extern int bar; //Since declared volatile in Module A,we can read and modify this variable.

  • 相关阅读:
    刷题238. Product of Array Except Self
    刷题236. Lowest Common Ancestor of a Binary Tree
    刷题208. Implement Trie (Prefix Tree)
    A1070
    A1048
    A1050
    A1041
    A1092
    A1084
    n进制转十进制
  • 原文地址:https://www.cnblogs.com/michael2016/p/6926391.html
Copyright © 2011-2022 走看看