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!