What is a function prototype used for ?

2024

What is a function prototype used for ?

  1. A.

    To define the return type of a function

  2. B.

    To declare the function before its definition

  3. C.

    To specify the function's parameters

  4. D.

    To document the function's purpose

Attempted by 164 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.

Explore the full course: Tpsc Assistant Technical Officer