LearnFrenzy
Sign in Take a free test

C Variables · Variables MCQ · Question 4

Is extern int x; a declaration or a definition? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 4 Back to Exercise

What does extern int x; at file scope do?

  • A Defines x and sets it to 0
  • B Declares x, which must be defined somewhere else in the program Correct
  • C Creates a local copy of x
  • D Makes x constant
Correct Answer: Option B

extern without an initializer only announces the name and type; no storage is created. Exactly one file must contain the definition (int x; or int x = 5;), or linking fails.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links