Why is creating a variable using 'extern' a declaration and not a definition?

后端 未结 5 1241
-上瘾入骨i
-上瘾入骨i 2021-01-21 22:42

I came across the following problem while reading ...just cant get the logic behind this.

auto int c;
static int c;
register int c;
extern int c;
5条回答
  •  [愿得一人]
    2021-01-21 22:54

    First three are definition because it will set aside storage for the variables.

    Last one will not allocated any storage for int c. It will just use storage allocated and named elsewhere.

提交回复
热议问题