What's the difference between the inline
specifier and the extern
keyword when applied to a variable?
Asked
Active
Viewed 1,052 times
1

Remy Lebeau
- 555,201
- 31
- 458
- 770

Zeyd
- 59
- 2
-
Related: [How do inline variables work?](https://stackoverflow.com/questions/38043442/how-do-inline-variables-work) – Borgleader May 31 '18 at 11:49
1 Answers
6
extern
says that the variable definition resides in a translation unit elsewhere.
inline
for global/namespace scope variable means that the definition is provided at the spot. Without inline
or const
there will be multiple symbol definition linker error.

Maxim Egorushkin
- 131,725
- 17
- 180
- 271
-
1inline variable has same address in all translation units same thing for the extern variable. – Zeyd May 31 '18 at 11:58
-