Use a prototype when readability or organization demands a different order than top-to-bottom. The two main cases. First, when you want main at the top of the file with helper functions below, main calls the helpers, so the compiler needs to know their signatures before it sees the calls. Second, when functions in different .c files need to call each other: each file has only one function's body, so the other has to be declared via prototype (typically pulled in from a header .h file). Without a prototype, calling a function before it's defined either produces a compile error (modern C) or silently assumes int return and unchecked arguments (pre-C99, very dangerous).
Programming Fundamentals · Interview question
When should you use a prototype declaration versus defining the function before its caller?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Functions
Naming a chunk of logic so you can call it from many places. Parameters in, return value out, scope rules: the building block of every program.