C++

Asked • 07/27/19

When to use extern in C++?

I'm reading "Think in C++" and it just introduced the `extern` declaration. For example: extern int x; extern float y; I think I understand the meaning (declaration without definition), but I wonder when it proves useful. Can someone provide an example?

1 Expert Answer

By:

Keith B. answered • 07/28/19

Tutor
4.6 (22)

Software Engineer and Math Geek

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.