zoukankan      html  css  js  c++  java
  • 'extern'

    The external variables in methods are defined by the first lines of the example above, which
    state their type and cause storage to be allocated for them. Syntactically, external definitions are just like
    definitions of local variables, but since they occur outside of functions, the variables are external. Before a function
    can use an external variable, the name of the variable must be made known to the function; the declaration is the
    same as before except for the added keyword extern.


    In certain circumstances, the extern declaration can be omitted. If the definition of the external variable occurs
    in the source file before its use in a particular function, then there is no need for an extern declaration in the
    function. In fact, common practice is
    to place definitions of all external variables at the beginning of the source file, and then omit all extern
    declarations.


    If the program is in several source files, and a variable is defined in file1 and used in file2 and file3, then extern
    declarations are needed in file2 and file3 to connect the occurrences of the variable. The usual practice is to collect
    extern declarations of variables and functions in a separate file, historically called a header, that is included by
    #include at the front of each source file. The suffix .h is conventional for header names. The functions of the
    standard library, for example, are declared in headers like <stdio.h>.

  • 相关阅读:
    Python操作 RabbitMQ、Redis、Memcache、SQLAlchemy
    Django的ORM操作
    RabbitMQ
    CentOS忘记用户名或者密码解决办法
    VUE-es6
    vue基础之命令
    爬虫框架:scrapy
    爬虫高性能相关
    MongoDB
    Beautifulsoup模块
  • 原文地址:https://www.cnblogs.com/wjshan0808/p/3341258.html
Copyright © 2011-2022 走看看