A function prototype also referred to as a function interface is a declaration of a function that specifies the function's name and type signature (i.e. arity, parameter types, and returntype), but it omits the function body.
A function prototype is a function declaration that typically specifies the data types of its arguments in a given parameter list.
Also, a prototype is necessary along with all modifiers, as the two styles can be mixed for any single function, however, this is not recommended.
Prototypes are syntactically distinct from the old style of a function declaration. This is because, a function definition specifies how the function does what it does (i.e. its "implementation"), but a function prototype merely specifies its interface (i.e. what data types go in and come out of it).
In a prototype function, parameter names are optional. However, C and C++ languages have function prototype scope; this means their scope ends at the end of the prototype)
Below is the comparison of the old and the prototype styles of declaration.
Old style:
In this case, functions can be declared implicitly by their appearance in a call.
In addition, arguments to a function undergo the default conversions before the call.
Lastly, the number and type of arguments are not checked.
Prototype style:
In the prototype, arguments to a function are converted to the declared type of the parameter.
Also, multiple declarations must be compatible, and also parameter types must be in agreement.
Here functions are declared explicitly with a prototype before their call.
In a parameter list of a prototype, Ellipses are used to indicate that a variable number of parameters are expected.
The void keyword is used to designate empty parameter lists.