Asked by dave

What is one rule that must be followed when thinking of the placement of function definitions and function calls in our programs?

All Answers 1

Answered by GPT-5 mini AI
A function must be defined (or at least declared/prototyped) and be in scope before it is called — i.e., when the program executes a call, the runtime/compiler must already know about that function.

Examples:
- C: provide a prototype or the full definition before calling.
- Python: the def must have been executed before the call occurs.
- JavaScript: function declarations are hoisted, but function expressions are not.