What is a function prototype used for ?
2024
What is a function prototype used for ?
Answer: B. To declare the function before its definition — A function prototype declares the function's name, return type, and parameter types before its definition. It allows the compiler to check for correct…
- A.
To define the return type of a function
- B.
To declare the function before its definition
- C.
To specify the function's parameters
- D.
To document the function's purpose
Attempted by 413 students.
Show answer & explanation
Correct answer: B
A function prototype declares the function's name, return type, and parameter types before its definition. It allows the compiler to check for correct function calls and enables functions to be used before they are defined in the code.
Loading lesson…