when variable has those modifier:
| n/a |
variable outside function |
variable inside function |
| default |
default as global, could combine with extern |
default as auto, local scope |
| auto |
can not use outside function |
local scope |
| register |
can not use outside function |
local scope but faster access |
| static |
internal linkage, global to translation unit, can not combine with extern |
persistent vairable to function |
static can also be used for function, when a function use static it means it can not be used outside its translation unit, such as declared in another file.
评论
发表评论