Saturday, October 10, 2009

Function prototype and signature

The signature of a function is a way of describing the parameters and parameter types with which a legal call to the function can be made. It contains the name of the function, its parameters and their type, and the return value.

For example : int fac(int n);

A function prototype in C or C++ is a declaration of a function that omits the function body but does specify the function's name, arity, argument types and return type. While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.

In a prototype, argument names are optional, however, the type is necessary along with all modifiers

For example : int fac(int n);

Reference 1 # http://en.wikipedia.org/wiki/Signature_(computer_science)
Reference 2 # http://en.wikipedia.org/wiki/Function_prototype

No comments: