-1

What's the difference between the inline specifier and the extern keyword when applied to a variable?

Remy Lebeau
  • 505,946
  • 29
  • 409
  • 696
Zeyd
  • 39
  • Related: [How do inline variables work?](https://stackoverflow.com/questions/38043442/how-do-inline-variables-work) – Borgleader May 31 '18 at 11:49

1 Answers1

5

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
  • 125,859
  • 15
  • 164
  • 254