- 论坛徽章:
- 0
|
本帖最后由 雨过白鹭洲 于 2010-04-02 14:06 编辑
5. If the declaration of an identifier for a function has no storage-class specifier,its linkage
is determined exactly as if it were declared with the storage-class specifier extern.If
the declaration of an identifier for an object has file scope and no storage-class specifier,
its linkage is external.- 文件f1.c
- #include "f1.h"
- int i; // 这实际上只是声明,等同于extern int i;
- int i; // 同上
- void setone()
- {
- printf("f1 i = %的\n", i);
- }
- 文件mymain.c
- #include "f1.h"
- int i = 100; // 这里才是实际的定义
- int main()
- {
- printf("mymain i = %d\n", i);
- setone();
-
- }
复制代码 |
|