Multiple choice

How is a variable accessed from another file?

  1. The global variable is referenced via the extern specifier.

  2. The global variable is referenced via the auto specifier.

  3. The global variable is referenced via the global specifier.

  4. The global variable is referenced via the pointer specifier.

  5. The global variable is referenced via the ext specifier.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To access a global variable defined in another file, you must declare it with the extern specifier, which tells the compiler the variable exists elsewhere. The extern declaration doesn't allocate storage, it just references the existing definition. Option B is wrong because auto is for local variables. Option C and D are not valid specifiers. Option E uses an invalid specifier name.