LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Declarations MCQ · Question 2

extern int fun(); vs int fun(); – any difference? Answer, explanation & discussion

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

Is there any difference between extern int fun(); and int fun();?

  • A Yes, the first one is a definition
  • B No – function declarations have external linkage by default Correct
  • C Yes, the second one is local to the file
  • D The first is invalid
Correct Answer: Option B

Unless declared static, a function has external linkage, so extern on a function declaration is redundant. (In C23 both also mean "takes no parameters".)

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