LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Declarations MCQ · Question 6

When must a function prototype appear? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 6 Back to Exercise

When do we need to give a function's prototype?

  • A After the function is defined
  • B Before the function is called, when the definition comes later or is in another file Correct
  • C Only for functions returning int
  • D Never in C99
Correct Answer: Option B

The compiler must know a function's type before a call. If the definition appears earlier in the same file it serves as the declaration; otherwise a prototype (usually from a header) is required.

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